-1

I have a local repo and it has some branches, e.g. branch1, branch2..

I want to push the branches to different remote repos, how?

Bill
  • 101
  • 8
  • This is about configuring your git remotes. I would recommend learning about them. It will help you in the long run. Stackoverflow already has many posts that can help you in this. [This can help](https://stackoverflow.com/q/28300580/2915738). And also [For more detailed explanation](https://stackoverflow.com/a/5617350/2915738) – Asif Kamran Malick Dec 09 '21 at 13:31

1 Answers1

1

Simply

git push https://repo.one/there branch1
git push https://repo.two/elsewhere branch2

If you want to shorten your commands, you can predefine the remote destinations:

git remote add one https://repo.one/there
git remote add two https://repo.two/elsewhere

Then the commands can be shortened to

git push one branch1
git push two branch2

You can also set the default push destinations:

git branch --set-upstream-to=one/branch1 branch1
git branch --set-upstream-to=two/branch2 branch2
j6t
  • 9,150
  • 1
  • 15
  • 35