几周前,我在 GitHub 上创建了一个公共(public)项目。今天,我想尝试一些东西,但我想确保我使用的副本是最新的。
我可以先更新我的 fork 吗?
如果在我开始更改后 fork 发生更改,会发生什么情况。我可以再次更新我的 fork ,同时将我的更改保留在那里(即 merge ,如果需要的话?)
最佳答案
是的,您可以 pull
原始存储库中的更改到您的复刻中。向它添加一个 Remote (因为 origin 将是你的 fork )并 pull 。
这来自 GitHub 帮助:
首先,向原始存储库添加一个 Remote 。
在这里帮助:http://help.github.com/remotes/
然后您可以 pull 对原始存储库的更新。引自 http://help.github.com/fork-a-repo/
Pull in upstream changes
If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:
$ git fetch upstream
$ git merge upstream/master
所有这些都是通过命令行来完成的。
以下是 TortoiseGit 的说明:
右键单击您的项目 -> TortoiseGit -> 设置 -> 远程。
在此处添加远程详细信息:
现在,右键单击 -> TortoiseGit -> pull 。
您将看到一个对话框来选择 Remote (您应该能够看到您在上一步中添加的 Remote )。选择它并 pull 。
关于git - 我可以将 git 上的 fork 项目更新为原始/主副本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7297486/