Search code examples
gitgithubbranch

How to pull a specific branch from Github


There is this repo :

https://github.com/googlesamples/android-architecture

And there is this branch :

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 ?


Solution

  • If you did a clone, then all branches should be available to you. You need to checkout the branch.

    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 pull origin todo-mvvm-databinding will fetch and merge this branch into your local one.