Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9046399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:39:21+00:00 2026-06-16T11:39:21+00:00

I accidentally pulled down a branch with the same name as a local branch

  • 0

I accidentally pulled down a branch with the same name as a local branch

* 909a2b5 - (HEAD, feature/form) xxxx <imrane>
* c9d6bc5 - xxxx <imrane>
| * 6e96409 - (origin/feature) xxx <anandmv>
|/  
*   38e35d8 - (origin/develop, origin/HEAD, develop) xxx <imrane>

I had committed all changes to my local branch, then ran

git fetch origin

and then tried to track the remote branch and got the following error

git checkout --track origin/feature
error: there are still refs under 'refs/heads/feature'
fatal: Failed to lock ref for update: Is a directory

Questions:
1. How do I revert without losing the commits I had on feature/form
2. How do I pull down the branch without having a naming collision?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:39:22+00:00Added an answer on June 16, 2026 at 11:39 am

    You are slightly misinterpreting your situation:

    • You do not need to revert anything, you didn’t lose anyting
    • Your situation is as follows: You have a local branch named feature/form, the remote has branch a named feature. Now this may come as a surprise, but these names conflict. feature/form actually creates a folder named “feature” with a branch named “form” in it. Because of that you can not create a branch named “feature”, as a folder with that name already exists.
    • git checkout --track origin/feature tries to create a branch named “feature”, which is not possible, so it fails.
    • regarding question 2: Well, there just is a naming collision – these two branches can’t coexist in your local repo. But you can work on the remote feature branch without deleting or renaming your local feature/form branch – even though I would not really recommend that as it’s easy to get confused there.
    • Running this command:

      git checkout -b mylocalname --track origin/feature
      

      will generate a local branch named mylocalname that tracks the remote branch feature on the remote origin.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I accidentally ran git merge some_other_branch on my local master branch. I haven't pushed
I've accidentally pulled to my local bazaar repo from a wrong location. Fortunately my
I accidentally did a hg pull and it created a branch in my local
I pulled a stupid and accidentally committed a folder named ${env.CATALINA_HOME} to my subversion
Accidentally I found this post about a new feature in ASP.NET 4.0: Expressions enclosed
I accidentally deleted the keys in my Keychain Access on my local computer which
I've accidentally pulled some changes from the main repo with --rebase parameter. How do
Accidentally I forgot to open a new branch and committed my changes to the
I accidentally added and committed a file with the wrong name. No problem. Tortoise
I accidentally created a branch called remotes/origin/remotes/origin/aclark and can't delete it with: git branch

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.