我分叉了一个项目,应用了几个修复程序,并创建了一个可接受的提取请求。几天后,另一个贡献者做了另一个改变。所以我的叉子不包括这个变化。 # y7 J8 ~7 @0 u7 L, m3 k我怎样才能把零钱放在叉子里?当我有进一步的改变来做出贡献时,是否需要删除和重建我的分叉?还是有更新按钮?: Y9 g. }' h* B! o8 N i' z
) z. ~ N5 q% s, p) E, J解决方案: % G4 J' U- P3 G7 U: x0 g 在分叉存储库的本地克隆中,您可以使用原始 GitHub 存储库被添加到远程中。(远程就像存储 URL 的昵称 -origin例如,它是一个。)然后你可以从上游存储库中获得所有的分支,并重新设置你的工作,以继续在上游版本中工作。以下命令可能如下:2 o, M% i( a0 q! x; _) F
# Add the remote,call it "upstream":git remote add upstream https://github.com/whoever/whatever.git# Fetch all the branches of that remote into remote-tracking branchesgit fetch upstream# Make sure that you're on your master branch:git checkout master# Rewrite your master branch so that any commits of yours that# aren't already in upstream/master are replayed on top of that# other branch:git rebase upstream/master & W' |7 o5 e3 n) C- C2 O4 t