How do I solve a Git checkout error: updating paths is incompatible with switching branches?

0 votes

I’m trying to fetch a remote branch by running the following command:

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

But this leads to the following error:

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?

Jul 26, 2018 in Git & GitHub by Tyrion anex
• 8,280 points
326 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

This error occurs when you are checking out a remote branch that your local git repo is unaware of. To solve this, run:

git remote show origin

If the remote branch you are trying to checkout is specified under "New remote branches" and not under "Tracked remote branches" then you have to fetch the branch first, follow the below commands:

git remote update
git fetch

Now try:

git checkout -b local-name origin/remote-name
answered Jul 26, 2018 by Sophie may
• 9,070 points

Related Questions In Git & GitHub

0 votes
1 answer

How to solve the ‘Git commit -a error’?

This happens when no editor is set. ...READ MORE

answered Jul 5, 2018 in Git & GitHub by Tyrion anex
• 8,280 points
29 views
0 votes
1 answer

How to do a re-merge into another branch in git

Seems like you want to rebase your ...READ MORE

answered May 7, 2018 in Git & GitHub by DareDev
• 6,560 points
61 views
0 votes
1 answer
0 votes
1 answer

How do I install Git on windows?

Hey @Akash, follow these steps: Go to this ...READ MORE

answered Feb 19 in Git & GitHub by Nikhil
42 views
+13 votes
2 answers
0 votes
1 answer
0 votes
1 answer

How to forcefully commit a file to Git even if the file is ruled as unchanged?

This is simple, just follow the below ...READ MORE

answered Jul 11, 2018 in Git & GitHub by Sophie may
• 9,070 points
21 views
0 votes
1 answer

How to view the nested workflow of a local git repository?

The ‘git log’ command is your closest ...READ MORE

answered Jul 4, 2018 in Git & GitHub by Sophie may
• 9,070 points
38 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.