由于未合并的文件,无法更改分支或提交。无法合并或隐藏文件,因为我在错误的分支中

Can't change branch or commit because of unmerged files. Can't merge or stash files because I'm in the wrong branch

我去推送了一些文件,但出现了合并错误。我修复了它并再次合并但是得到一个错误,我不再在分支中。

我去切换回分支但不能;我收到一条错误消息,说我仍然需要合并我的更改。当然,如果我尝试合并更改,我会收到一条错误消息,提示我不在正确的分支中。如果我尝试隐藏也一样。

有人知道我该如何解决这个问题吗?或者至少回到我的分支而不需要合并?

当我尝试更改分支时:

error: you need to resolve your current index first
filename.inc: needs merge

当我尝试提交时:

BUILD FAILED
You are not on the correct branch.

Git状态:

# Changes to be committed:
#
#       modified: styles.inc

# Unmerged paths:
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#       both modified: filename.inc
  1. 使用 git diff filename.inc 检查您是否确实合并了文件。
  2. 使用 git add filename.inc 确认合并。
  3. 使用 git commit 提交此合并。
  4. 你们现在都很好。