Last Updated: October 04, 2020
· fr0gs

git checkout remote branch

In your workflow you'll often need to checkout and fetch branches from a remote repository to do code review of your colleagues for example.


git checkout -b <local-branch> <remote-branch>
git fetch

So for example I have a branch called feature/abc remotely

git checkout -b feature/abc origin/feature/abc

There is also a shortcut for this command:

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

Related protips:

Remove all your local git branches but keep master