将原始GitHub存储库中的新更新引入分叉的GitHub存储库 [英] Pull new updates from original GitHub repository into forked GitHub repository

查看:106
本文介绍了将原始GitHub存储库中的新更新引入分叉的GitHub存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在GitHub上分发了某人的存储库,并且希望使用原始存储库中提交的更新和更新来更新我的版本。这些是在我分发我的副本之后创建的。



如何获取原始数据中所做的更改并将它们合并到我的存储库中?

解决方案

您必须将原始存储库(您分叉的那个)添加为远程存储库。

从。



另见 Git fork是git clone?


I forked someone's repository on GitHub and would like to update my version with commits and updates made in the original repository. These were made after I forked my copy.

How can I pull in the changes that were made in the origin and incorporate them into my repository?

解决方案

You have to add the original repository (the one you forked) as a remote.

From the GitHub fork man page:

Once the clone is complete your repo will have a remote named "origin" that points to your fork on GitHub.
Don’t let the name confuse you, this does not point to the original repo you forked from. To help you keep track of that repo we will add another remote named "upstream":

$ cd github-services
$ git remote add upstream git://github.com/pjhyett/github-services.git
$ git fetch upstream

# then: (like "git pull" which is fetch + merge)
$ git merge upstream/master master

# or, better, replay your local work on top of the fetched branch
# like a "git pull --rebase"
$ git rebase upstream/master

You have also a ruby gem which can facilitate those GitHub operations.

See also "Git fork is git clone?".

这篇关于将原始GitHub存储库中的新更新引入分叉的GitHub存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆