fixed pushall script + update
[dotfiles.git] / Scripts / git-pushall
1 #!/bin/sh
2
3 # you can pass in git parameters to this script too
4 # e.g
5 # git-pushall git --git-dir=$HOME/.dotfiles --work-tree=$HOME
6
7 # cmd="$@"
8 # [ -z "$cmd" ] && cmd="git"
9
10 # config_path="$($cmd config --local -l)" 2>/dev/null
11 # [ ! "$?" = 0 ] && echo "Failed: not a git repo." && exit 1
12
13 # echo "$config_path" | grep '^remote.*.url=' |\
14 #     sed 's/^remote.*.url=//' |\
15 #     xargs printf "$cmd push %s master\n" |\
16
17 [ -z "$1" ] && echo "Please provide a branch to push to" && exit 1
18
19 config_path="$(git config --local -l)" 2>/dev/null
20 [ ! "$?" = 0 ] && echo "Failed: not a git repo." && exit 1
21
22 echo "$config_path" | grep '^remote.*.url=' |\
23     sed 's/^remote.*.url=//' |\
24     xargs -I _ git push _ "$1"