How to checkout remote branch git?

git, git-checkout, github

Solution

After a `git fetch`, check the list of the remote tracking branches with:

git branch -avv

If you see `origin/test_01`, a `git checkout test_01` should work, since it is the equivalent of:

git checkout -b <branch> --track <remote>/<branch>

Or, since Git 2.23+, Q3 2019:

git switch <branch>

(through its "guess mode", that will be the same as `git switch -c <branch> --track <remote>/<branch>`)

But since it does not work, it is likely the `test_01` branch was merged to `master` locally by the other developer, and only `master` was pushed.

You can try and look for the commit of that unnamed branch merged into `master`: see "Find merge commit which include a specific commit".

Problem

Me and my team member are working on same repository. Someone create a branch from master called test_01, worked on that and commit, push to test_01 and merge to master. In the meantime some commit are done in master. Now I want to checkout that test_01 so that I write ``` git checkout test_01 ``` and got a git error : pathspec 'test_01' did not match any file know to git .

Original source

Related problems