Submit

How to checkout to a remote branch that someone else is working on in git?

· Flight Rules · Solving Mistories

First, fetch all branches from remote:

$ git fetch --all

Say you want to checkout to production from the remote.

$ git checkout --track origin/production
# Branch production set up to track remote branch production from origin.
# Switched to a new branch 'production'

(--track is shorthand for git checkout -b [branch] [remotename]/[branch])

This will give you a local copy of the branch production, and any update that has been pushed will also show up remotely

Want to Contribute?

Send me an Email, ping me on Twitter or submit a pull request on Github.

Sign up below to receive updates, tips and more handy tutorials when git screws up. It’s good stuff & I don’t spam.