简体   繁体   English

克隆了一个 repo,如何从原始 repo 更新新 repo 中的所有分支/master?

[英]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:我克隆了一个 repo,并在我的新 repo 中将遥控器添加到原始 repo 中,所以它看起来像这样:

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 .这会将标签分支推送到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:然后在任何 repo 中使用它来获取每一个新东西:

git fetch --all
git pull -all

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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