无法更改分支:由于(已经?)未跟踪文件而合并冲突

时间:2015-06-01 10:37:53

标签: git version-control branch merge-conflict-resolution

我已经遇到了无法检查分支的问题(请参阅here)。在我强制结帐(00000000 48 45 4c 4c 4f 0a |HELLO.| )并进行合并和标记之后,我现在想要切换回 develop 分支。这就是我得到的:

git checkout master -f

这是git checkout develop MyProject.userprefs: needs merge error: you need to resolve your current index first 给出的内容:

git status

我在开头有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") 文件,但是将其从 develop 分支中删除并将其添加到MyProject.userprefs。现在, master 分支中似乎不会忽略该文件。

有趣的是,该文件似乎在索引.gitignore中被跟踪了两次:

git ls-files --stage

我应该简单地删除 MyProject.userprefs 吗?但IDE需要这样做。我应该在分支中重新创建索引吗?

1 个答案:

答案 0 :(得分:0)

我做了Resolving a merge conflict from the command line中描述的解决方案:

git rm MyProject.userprefs

现在我能够改变分支。