Pushing sll Changes to all remotes
I frequently have multiple copies of my git repositories on different servers for backup purposes. I have tried ZSH brace expansion to do things like git push {origin,home} master
but it would never work correctly.
I finally gave up and wrote this function and put it in my ZSH startup routine:
# Git Push All
function gpa(){
for r in $(git remote); do
echo "Pushing All Changes to $r";
git push $r --all;
echo "";
done
}
This will enumerate all configured git remotes and push all changes to them. You might want to add a git push $r --tags;
line as well.
Obviously this is not a one size fits all solution, but for when I need it there it is.
Written by Andrew Burns
Related protips
1 Response
Or you can install hub ( http://hub.github.com ) and do exactly what you originally tried ( git push origin,home )
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Git
Authors
Related Tags
#git
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#