在GitHub上更新fork项目 [英] Update forked project on GitHub
问题描述
假设我克隆的一个存储库(并且只为我读取)是:
git @ github。 com:secret_project / dev.git分支:dev
我分配了项目和URL:
git@github.com:secret_user / Dde.git
(我可以完全访问:读取+写入)
但有人更新 git@github.com :secret_project / dev.git
来自另一个分叉版本。
假设文件已更改
git@github.com:secret_project / dev.git(test.txt)
内容:
嗨!
但是我的分支项目有 test.txt
包含内容的文件:
hi
那么如何在本地和我的仓库中更新分叉项目?
我应该使用哪些命令?并且请举例说明我的存储库...
您应该为原始存储库添加远程地址'上游
'到你的本地仓库(这是你的 Dde.git
fork的克隆):
git remote add upstream git://github.com/secret_project/dev.git# public read-only URL
这将允许您将'上游
'放入您自己的分支中(合并并解决任何问题合并冲突 test.txt
)。
然后你将你的本地分支推送到你的 Dde
GitHub仓库。
请参阅 GitHub帮助页面:使用遥控器了解更多详情。
Let's say a repository from which I clone (and only read-only for me) is:
git@github.com:secret_project/dev.git branch: dev
I forked project and URL:
git@github.com:secret_user/Dde.git
(Which I have full access to: read+write)
But someone updated git@github.com:secret_project/dev.git
from another forked version.
Let's say file changed on
git@github.com:secret_project/dev.git (test.txt)
content:
hi!
But my forked project has test.txt
file with content:
hi
So how do I update the forked project locally and in my repository?
Which commands should I use? And please make an example with my showed repositories...
You should add the remote address for the original repository 'upstream
' to your local repository (which is a clone of your Dde.git
fork):
git remote add upstream git://github.com/secret_project/dev.git # public read-only URL
That will allow you to pull 'upstream
' into your own branch (merging and resolving any merge conflict in test.txt
).
Then you will push your local branch to your Dde
GitHub repository.
See GitHub help page: "Working with remotes" for more details.
这篇关于在GitHub上更新fork项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!