git 找到一个git分支路径
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10902769/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
finding a git branch path
提问by Chapsterj
I'm trying to send someone a clone link for a git repository.
我正在尝试向某人发送 git 存储库的克隆链接。
so this will give me access to cloning the master. But I want to give out a branch clone path how would I go about finding that path using terminal. The branch is a remote branch.
所以这将使我能够克隆主人。但是我想给出一个分支克隆路径,我将如何使用终端找到该路径。该分支是远程分支。
[email protected]:mainproject.git
回答by larsks
I'm not sure what you mean by "branch clone path", but maybe this will help...
我不确定你所说的“分支克隆路径”是什么意思,但也许这会有所帮助......
When you a clone a remote repository, you get all the branches. You typically end up on the master
branch, after which you can select your branch using the checkout
command:
当您克隆远程存储库时,您将获得所有分支。您通常会在master
分支上结束,之后您可以使用以下checkout
命令选择您的分支:
$ git clone [email protected]:mainproject.git
$ cd mainproject
$ git checkout mybranch
If you want to end up on a branch other than master
as part of the clone
operation, you can use the -b
(--branch
) option:
如果你想在一个分支而不是master
作为clone
操作的一部分结束,你可以使用-b
( --branch
) 选项:
$ git clone -b mybranch [email protected]:mainproject.git
This would switch the local repository to the mybranch
branch after completing the clone operation. This is identical to the above sequence of commands (well, other than the cd
command).
这将mybranch
在完成克隆操作后将本地存储库切换到分支。这与上面的命令序列相同(嗯,除了cd
命令)。
If this doesn't address your question, please let me know.
如果这不能解决您的问题,请告诉我。
回答by Fatih Arslan
Just look for remote branches
只需寻找远程分支
git branch -r
After that give clone it via
之后通过克隆它
git clone [email protected]:mainproject.git -b remote_branchh