Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
分叉在GitHub中更新的存储库_Git_Github_Fork - Fatal编程技术网

分叉在GitHub中更新的存储库

分叉在GitHub中更新的存储库,git,github,fork,Git,Github,Fork,获取更新的存储库的最佳方式是什么?通常有一个按钮写着“Fork”,但有一个“yourfork”按钮代替了它。这是因为我已经分叉了一个旧版本的存储库吗 您可以通过命令更新存储库 git fetch 然后环顾四周,如有必要,进行合并/重新设置基础。您应该将原始存储库作为源添加到本地git存储库中 cd /my/local/repository git remote add upstream git@github.com/author/originalrepo.git 你可以选择任何你想要的名字,

获取更新的存储库的最佳方式是什么?通常有一个按钮写着“Fork”,但有一个“yourfork”按钮代替了它。这是因为我已经分叉了一个旧版本的存储库吗

您可以通过命令更新存储库

git fetch

然后环顾四周,如有必要,进行合并/重新设置基础。

您应该将原始存储库作为源添加到本地git存储库中

cd /my/local/repository
git remote add upstream git@github.com/author/originalrepo.git
你可以选择任何你想要的名字,但我通常会选择上游

使用
git pull upstream master
您可以从原始回购中获取主分支,合并更改,并使用
git push origin master
将其推到您的分支

可能的重复