简体   繁体   中英

how to push different branches to different remote repos in one repo?

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM