Push to several remotes at once with git
Sometimes you push to several remotes at once.
and it gets laborious to keep typing
$ git push origin --all && git push nodester --all && git push duostack --all
you might be thinking, who pushes to three remotes at once? , Well you just might want to.
After a bit of poking google I found this little gem
- Open up your
.gitconfig
from a shell
$ git config --global -e
- then add this
[remote "all"]
url = origin-host:path/yourRepo.git
url = nodester-host:path/yourRepo.git
url = duostack-host:path/yourRepo.git
- or if you just want to stay in the shell, for the CLI purists here ya' go
$ git remote add all origin-host:path/proj.git
$ git remote set-url --add all nodester-host:path/proj.git
$ git remote set-url --add all duostack-host:path/proj.git
- After you set it up you can just type
$ git push all --all
Quite lovely, if must say so myself.
-Enjoy
Written by Jupiter St John
Related protips
1 Response
Cool idea! If you want to go even simpler (might only work for some with a simple setup), and you have a few remotes you constantly push to, you can also add a simple alias for those to your .gitconfig:
Push to both origin and heroku repos
gpa = !git push && git push heroku master
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#