X-Git-Url: https://git.danieliu.xyz/?p=dotfiles.git;a=blobdiff_plain;f=Scripts%2Fgit-pushall;fp=Scripts%2Fgit-pushall;h=9fd1967f3e71dd2619d36b04ab3f47058b7d2424;hp=0000000000000000000000000000000000000000;hb=e5525db34feb526da67652250fed25bd9db2362f;hpb=68c67b541445ec5c32c4660243d906b4c5479115 diff --git a/Scripts/git-pushall b/Scripts/git-pushall new file mode 100755 index 0000000..9fd1967 --- /dev/null +++ b/Scripts/git-pushall @@ -0,0 +1,12 @@ +#!/bin/sh + +# reads the config file and pushes to all the remotes + +config_path="$(git rev-parse --show-toplevel)/.git/config" 2>/dev/null + +[ ! "$?" = 0 ] && echo "Failed: not a git repo." && exit 1 +[ -z "$1" ] && echo "Failed: Please supply a branch to push to." && exit 1 + +# look for all remotes +cat "$config_path" | sed '/^\[remote "/!d; s/^\[remote "//; s/"]$//' |\ + xargs -I _ git push _ "$1"