pushall script
[dotfiles.git] / Scripts / git-pushall
1 #!/bin/sh
2
3 # reads the config file and pushes to all the remotes
4
5 config_path="$(git rev-parse --show-toplevel)/.git/config" 2>/dev/null
6
7 [ ! "$?" = 0 ] && echo "Failed: not a git repo." && exit 1
8 [ -z "$1" ] && echo "Failed: Please supply a branch to push to." && exit 1
9
10 # look for all remotes
11 cat "$config_path" | sed '/^\[remote "/!d; s/^\[remote "//; s/"]$//' |\
12     xargs -I _ git push _ "$1"