Wednesday, May 30, 2012

Can't check out a remote branch from git?

Trying to check a remote branch out with git, and having it deny the existence of the remote branch? Or report something like:

$ git checkout --track -b 7.1 upstream/7.1
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'upstream/7.1' which can not be resolved as commit?

You need to fetch the remote. Not just the branch you want; git fetch upstream 7.1 won't work, you need git fetch upstream to fetch branch refs etc. See and

There's also a handy tool I didn't know about despite using git for a fair while now:

$ git remote show upstream
* remote upstream
  Fetch URL: git://
  Push  URL: git://
  HEAD branch: master
  Remote branches:
    7.1    new (next fetch will store in remotes/upstream)
    master new (next fetch will store in remotes/upstream)
  Local ref configured for 'git push':
    master pushes to master (up to date)

No comments:

Post a Comment

Captchas suck. Bots suck more. Sorry.