github叉子混淆 [英] github fork confusion

查看:141
本文介绍了github叉子混淆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循这个)

  git remote add upstream url:// upstream / repo 

OP opensourcelover 提及看到这个

  git remot e -v,

origin git@github.com:username / project.git(fetch)
origin git@github.com:username / project.git(推送)
上游git@github.com:用户名/ project.git(提取)
上游git@github.com:用户名/ project.git(推送)

如果您的 origin 与您的上游远程回购相同,那么你可以通过https的 upstream 替换那个url:

  git remote set-url upstream https://github.com/originalDevName/originalRepoName 

这样,你可以 git fetch upstream 并获得新的分支。



如果你需要 work >在这个新的分支上,你现在可以声明它:

  git branch -u upstream / foo foo 

code>

请参阅如何制作现有的Git分支跟踪远程分支?


I followed this https://help.github.com/articles/fork-a-repo post to clone a repository locally. After doing that another developer created a branch to the main repository and added some features to that branch. My question is

  1. How do I get that branch into my fork.
  2. Can I get that missing branch again to my local using git pull upstream/missing_branch command?

Thank you

解决方案

You need to add a remote repo 'upstream' in the local repo (which has for origin your fork)

(git remote man page)

git remote add upstream url://upstream/repo

The OP opensourcelover mentions seeing this:

git remote -v, 

origin git@github.com:username/project.git (fetch) 
origin git@github.com:username/project.git (push) 
upstream git@github.com:username/project.git (fetch) 
upstream git@github.com:username/project.git (push) 

If your origin is the same as your upstream remote repo, you can replace that url by the https one for that upstream:

git remote set-url upstream https://github.com/originalDevName/originalRepoName

That way, you can git fetch upstream and get the new branch.

If you need to work on that new branch, you can now declare it:

git branch -u upstream/foo foo

See "How do you make an existing Git branch track a remote branch?".

这篇关于github叉子混淆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆