fetch remote branch with the same name

Viewed 16649

I want to fetch a branch from a remote, but my branch name does not start with remote name, for example:

git checkout -b BRANCH origin/BRANCH

It work in some cases, but in some cases I get this error:

fatal: git checkout: updating paths is incompatible with switching branches.

while i am sure that the remote has this branch, and this works:

git checkout -b origin/BRANCH

After that, I have to switch to another branch and rename branch origin/BRANCH to BRANCH, and then switch to BRANCH again... I want to know what that error means.

2 Answers
Related