I have two origins in my git repo:
- Origin: this is the GitHub origin.
- Heroku: the Heroku origin.
How can I push to the master branch of both origins with a single git push? I’m currently doing git push origin master && git push heroku master, but I feel there’s a easier way. Thanks!
In your
<repo>/.git/configyou can do something like this (I’m assuming thegithubandherokuremotes are already defined, but you may have different actual names for them):Then, when you run
git push both, it will push to both. You can add fetch/push refspecs or other options to the “all” remote definition too, if appropriate/necessary. I don’t think you can have different refspecs for the two urls, though so that could be a minor inconvenience…