In my previous project repository was hosted on github.com and application was supposed to deployed on heroku which was also provide a git repository. Every time I had to push code on main repository and after that same changes need to pushed on heroku git repo. I found solution that we can manage multiple remote by doing following step.
- Open terminal and changed dir to your project.
git remote -v
which will show you your current origin
- Add new remote repo by executing
git remote add heroku git@newremoterepo
Now you have 2 remote repo and ready to pull push or merge.
When you have to push code in main repo you can do
git push origin master
and if you want to push the change in other remote repo you can simply do
git push heroku master
If you want to push the branch code of main repo into another branch of other repo then you can do it by executing
git push heroku mainrepobrach:otherreopbranchname
Hope it help.