Git checkout updating paths is incompatible with switching branches

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

http://stackoverflow.com/questions/180064 http://stackoverflow.com/questions/180064

I try to fetch a remote branch with the command

git checkout -b local-name origin/remote-name

but I get this error message:

fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout origin/remote-name which can not be resolved as commit?

If I manually create a branch and then pull the remote branch, it works, just as making a new clone and checking the branch out.

Why does it not work on the repository I work with?

Answers

I believe this occurs when you are trying to checkout a remote branch that your local git repo is not aware of yet. Try:

git remote show origin

If the remote branch you want to checkout is under "New remote branches" and not "Tracked remote branches" then you need to fetch them first:

git remote update
git fetch

Now it should work:

git checkout -b local-name origin/remote-name

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/945654/git-checkout-updating-paths-is-incompatible-with-switching-branches

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils