如何将fork与原始GitHub项目同步? [英] How to synchronize fork with original GitHub project?
本文介绍了如何将fork与原始GitHub项目同步?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一些GitHub项目的分支.然后,我创建了新分支,并在该分支内做了一个补丁.我向作者发送了 pull请求,他应用了我的补丁并在以后添加了一些提交.现在如何将GitHub上的fork与原始项目同步?我是否要在GitHub上删除我的fork并每次为每个补丁创建一个新的fork?
I created the fork of some GitHub project. Then I created new branch and did a patch inside of that branch. I sent the pull request to author and he applied my patch and added some commits later. How can I synchronize my fork on GitHub with original project now? Am I to delete my fork on GitHub and create new fork for each my patch each time?
推荐答案
您无需再次refork
.只需添加一个远程服务器(例如upstream
)和fetch upstream
即可更新克隆的存储库.
You don't need to refork
again. Just add a remote (say, upstream
) and fetch upstream
to update your cloned repository.
$ git remote add upstream <original-repo-url>
$ git fetch upstream # update local with upstream
$ git diff HEAD..upstream/master # see diffs between local and upstream/master (if there is no diff then both are in sync)
$ git pull upstream master # pull upstream's master into local branch
$ git push origin HEAD # push to your forked repo's remote branch
这篇关于如何将fork与原始GitHub项目同步?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文