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,700 points
10,558 views

1 answer to this question.

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
• 10,620 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,700 points
2,368 views
+1 vote
1 answer

How do I rename a local Git branch?

Hi@akhtar, You can rename your branch name. Sometimes ...READ MORE

answered Sep 4, 2020 in Git & GitHub by MD
• 95,460 points
742 views
0 votes
1 answer

How do I go to a particular version of a file in the Git repository?

Hi@akhtar, You can use git checkout <sha1> to check ...READ MORE

answered Jan 5, 2021 in Git & GitHub by MD
• 95,460 points
2,933 views
0 votes
0 answers

How do I use git reset --hard HEAD to revert to a previous commit

When I revert this commit: git reset --hard ...READ MORE

May 15, 2022 in Git & GitHub by Kichu
• 19,040 points
881 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,053 views
+2 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
• 10,620 points
14,157 views
0 votes
2 answers

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

The closest way to view branches in ...READ MORE

answered Aug 2, 2019 in Git & GitHub by Sirajul
• 59,230 points
1,613 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP