简体   繁体   English

我想创建一个仓库,添加一个功能并与原始仓库保持同步

[英]I want to fork a repo, add a feature and keep syncing with original repo

I have a GitHub project, I have forked it now I know I can add a feature to it, but how do I keep syncing with the original project time to time 我有一个GitHub项目,我已经分叉了,我知道可以为其添加功能了,但是如何不时与原始项目保持同步

Will git remote originalurl.project and then git pull will help? git remote originalurl.project然后git pull会有所帮助吗?

Type git remote -v and press Enter. 输入git remote -v并按Enter。 You'll see the current configured remote repository for your fork. 您将看到当前为fork配置的远程存储库。

git remote -v
origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)

Type git remote add upstream, and then paste the URL you copied in Step 2 and press Enter. 键入git remote add上游,然后粘贴您在步骤2中复制的URL,然后按Enter。 It will look like this: 它看起来像这样:

git remote add upstream https://github.com/octocat/Spoon-Knife.git

To verify the new upstream repository you've specified for your fork, type git remote -v again. 要验证您为fork指定的新上游存储库,请再次键入git remote -v。 You should see the URL for your fork as origin, and the URL for the original repository as upstream. 您应该将叉子的URL作为源,将原始存储库的URL作为上游。

git remote -v
origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)

Now, you can keep your fork synced with the upstream repository with a few Git commands. 现在,您可以使用一些Git命令使fork与上游存储库同步。 For more information, see "Syncing a fork." 有关更多信息,请参阅“同步派生”。

from https://help.github.com/articles/fork-a-repo/ 来自https://help.github.com/articles/fork-a-repo/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM