0d7def61399ee9382740e8b38a4d9512f58c9d63
[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