如何在Git中分支分支? [英] How to fork a branch in Git?
问题描述
我分叉它,我意识到我有叉主分支。我做了一个 git pull origin 2-0-stable
,并且有大量的合并冲突。呃哦。
我想要做的就是在master旁边有另一个分支,就是精确和回购中的分支相同。 / b>
您应该签出其他分行:
git checkout origin 2-0-stable
Git会自动检测到你不'没有一个具有该名称的本地分支,但是您有一个具有该名称的远程分支。它将创建一个本地分支 2-0-stable
,它将与 origin / 2-0-stable
相同。并将配置跟踪。
如果您想从一开始就处于此状态,您应该 git clone
与 - 分支
选项。
git clone --branch 2- 0稳定< git url>
这将克隆回购,但会直接检出指定的分支。
Alright, so I need to fork a project, clone it, and what not. Thing is the master branch is 2000 or so commits ahead of the branch I need to be using. How do I fork a branch and not the main repo.
I forked it and I realized I had forked the master branch. I do a git pull origin 2-0-stable
and there are tons of merge conflicts. Uh oh.
All I want to do is have another branch beside master that is the exact same as the one up on the repo.
You should checkout the other branch:
git checkout origin 2-0-stable
Git will automatically detect that you don't have a local branch with that name, but you have a remote branch with that name. It will create a local branch 2-0-stable
which will be the same as origin/2-0-stable
and will have tracking configured.
If you want to be in this state from the beginning you should git clone
with the --branch
option.
git clone --branch 2-0-stable <git url>
This will clone the repo, but will directly check out the specified branch.
这篇关于如何在Git中分支分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!