git - 我可以将 git 上的 fork 项目更新为原始/主副本吗?

标签 git github tortoisegit fork

几周前,我在 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 -> 设置 -> 远程。

在此处添加远程详细信息:

enter image description here

现在,右键单击 -> TortoiseGit -> pull 。

您将看到一个对话框来选择 Remote (您应该能够看到您在上一步中添加的 Remote )。选择它并 pull 。

enter image description here

关于git - 我可以将 git 上的 fork 项目更新为原始/主副本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7297486/

相关文章:

git - 删除本地分支的危急情况

git - 如何将主分支与另一个分支及其提交一起切换?

git - 使用 wine 在 Mac 和 Linux 中运行 TortoiseGit

tortoisegit - 更改 TortoiseGit 中的存储库 url

git - git 是如何存储文件的?

python - Github 和 PyPi 上的自述文件

github - 在哪里可以下载 64 位 Travis-CI VM 镜像?

git - 我需要做什么来克隆 github repo

git - 可以在同一个存储库上使用多个 Git 客户端吗?

git - 适用于GIT的Visual Studio工具-FETCH/PUBLISH与PULL/PUSH