0

I already had the problem that I couldn't check out a branch (see here). After I forced the checkout (git checkout master -f) and did the merging and tagging, I now want to switch to the develop branch back. This is what I get:

git checkout develop
MyProject.userprefs: needs merge
error: you need to resolve your current index first

This is what git status gives:

On branch master
Your branch is ahead of 'origin/master' by 78 commits.
  (use "git push" to publish your local commits)
Unmerged paths:
  (use "git reset HEAD <file>..." to unstage)
  (use "git add/rm <file>..." as appropriate to mark resolution)

    deleted by us:   MyProject.userprefs

no changes added to commit (use "git add" and/or "git commit -a")

I had the file MyProject.userprefs in the beginning, but removed it from develop branch and added it to .gitignore. Now the file seems not to be ignored in the master branch.

What is also interesting is that the file seems to be tracked twice in the index git ls-files --stage:

100644 b16bd8d4e57de7705a5a388d045fed7376a1b175 1   MyProject.userprefs
100644 ef238f895ca1b80f10cfcd45349d82df925ff482 3   MyProject.userprefs

Should I simply delete MyProject.userprefs? But the IDE needs that. Should I recreate the index in the master branch?

Community
  • 1
  • 1
testing
  • 19,681
  • 50
  • 236
  • 417

1 Answers1

0

I did the solution described in Resolving a merge conflict from the command line:

git rm MyProject.userprefs

Now I was able to change the branch.

testing
  • 19,681
  • 50
  • 236
  • 417