我创建了一些github项目的分叉。然后我创建了一个新的分支,并在其中做了一个补丁。我向author发送了pull请求,他应用了我的补丁并在稍后添加了一些提交。现在如何将github上的fork与原始项目同步?我是否要删除github上的fork并每次为我的补丁创建新的fork?
最佳答案
您不需要再次refork
。只需添加一个远程(例如,upstream
)和fetch upstream
即可更新克隆的存储库。
$ 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