git 如何从 Github 中提取特定分支
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46367880/
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
How to pull a specific branch from Github
提问by Kevin ABRIOUX
There is this repo :
有这个回购:
https://github.com/googlesamples/android-architecture
https://github.com/googlesamples/android-architecture
And there is this branch :
还有这个分支:
https://github.com/googlesamples/android-architecture/tree/todo-mvvm-databinding/
https://github.com/googlesamples/android-architecture/tree/todo-mvvm-databinding/
I have clone the project but i have only the master. What can i do to get this branch ?
我已经克隆了这个项目,但我只有主人。我该怎么做才能得到这个分支?
回答by Strikegently
If you did a clone, then all branches should be available to you. You need to checkout the branch.
如果您进行了克隆,那么您应该可以使用所有分支。您需要结帐分支。
git checkout todo-mvvm-databinding
git checkout todo-mvvm-databinding
If the branch isn't available for whatever reason, then you can create it and then pull it:
如果分支由于某种原因不可用,那么您可以创建它然后拉取它:
git checkout -b todo-mvvm-databinding
-b
specifies "create branch"
git checkout -b todo-mvvm-databinding
-b
指定“创建分支”
git pull origin todo-mvvm-databinding
will fetch and merge this branch into your local one.
git pull origin todo-mvvm-databinding
将获取此分支并将其合并到您的本地分支中。