简体   繁体   中英

Cloned a repo, how to update all branches/master in new repo from original repo?

I cloned a repo and in my new repo I added the remote to the original repo so it looks like this:

origin  git@gitlab.com:MyDomain/MyCode.git (fetch) 
origin  git@gitlab.com:MyDomain/MyCode.git (push) 
original    git@gitlab.com:OldDomain/OriginalCode.git (fetch) 
original    git@hgitlab.com:OldDomain/OriginalCode.git (push)

We have multiple people working on the original repo and updating branches constantly. I will need to update origin with all the changes to original including its branches. How do I do this?

The simplest way is to do this is:

git push --all origin

This will push tags and branches to origin .

You can use merge command to get commits from the branches on "original" repo

(suppose your workspace is on origin)
git fetch original
git merge original/BRANCHE_NAME_COMMITS_COME_FROM

You can do this for pushing every thing:

git push --all
git push --tags

To push tags you need the second line too.
Then use this in any repo to get every new thing:

git fetch --all
git pull -all

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