有一个仓库:
https://github.com/googlesamples/android-architecture
和一个分支:
https://github.com/googlesamples/android-architecture/tree/todo-mvvm-databinding/
我已经克隆了这个项目,但是只有主分支。我该怎么做才能获取这个分支?
有一个仓库:
https://github.com/googlesamples/android-architecture
和一个分支:
https://github.com/googlesamples/android-architecture/tree/todo-mvvm-databinding/
我已经克隆了这个项目,但是只有主分支。我该怎么做才能获取这个分支?
git fetch
git branch -r
origin/HEAD -> origin/master
origin/develop
origin/feature/modular_approach
origin/master
步骤2:
确保将当前分支上的所有更改都提交,因为git会报告未提交代码的错误和警告。 选择一个分支并运行以下命令。
git checkout origin/feature/modular_approach
上述答案有效,但我想使用 fetch
和 checkout
发布,这也很好用。
步骤1: git fetch todo-mvvm-databinding
步骤2: git checkout todo-mvvm-databinding
您现在位于 todo-mvvm-databinding
分支上。
git checkout name_remote_branch
在这个新分支上进行一次拉取
git pull
git fetch origin todo-mvvm-databinding
。 - Sunday Okpokor