如何与远程Git仓库同步?
我在 github 上分叉了一个项目,做了一些更改,到目前为止一切顺利。
与此同时,我派生的存储库发生了变化,我想将这些更改添加到我的存储库中。我该怎么做?
I forked a project on github, made some changes, so far so good.
In the meantime, the repository I forked from changed and I would like to get those changes into my repository. How do I do that ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
一般来说 git pull 就足够了,但我不确定你选择了什么布局(或者 github 为你选择了)。
Generally
git pull
is enough, but I'm not sure what layout you have chosen (or has github chosen for you).假设他们的更新位于 master 上,并且您位于要将更改合并到的分支上。
另请注意,您随后需要将合并推送回存储库的副本:
Assuming their updates are on master, and you are on the branch you want to merge the changes into.
Also note that you will then want to push the merge back to your copy of the repository:
您必须将原始存储库添加为上游。
这里都有很好的描述: https://help.github.com/articles/fork-一个仓库
You have to add the original repo as an upstream.
It is all well described here: https://help.github.com/articles/fork-a-repo
您需要将原始存储库(您分叉的存储库)添加为远程存储库。
然后您需要将更改引入本地存储库
现在您将在本地存储库中拥有原始存储库的所有分支。例如,master 分支将是 github/master。有了这些分支,你就可以做你想做的事。将它们合并到您的分支等中
You need to add the original repository (the one that you forked) as a remote.
Then you need to bring in the changes to your local repository
Now you will have all the branches of the original repository in your local one. For example, the master branch will be
github/master
. With these branches you can do what you will. Merge them into your branches etc在 github UI 上,切换到要使用 fork 中的新更改进行更新的分支。
然后只需选择:
On github UI, switch to the branch you want to update with new changes from fork.
Then simply select: