我在解决工作副本上遇到的问题时遇到了麻烦:之前我拉了文件,它自动合并了几个文件,然后它们出现在我未提交的暂存区域中。我现在git checkout -- my/file
恢复了文件中的更改,当天晚些时候,我想再进行一次拉取,但是不能,我得到了类似的错误:
$ git pull
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
fatal: Exiting because of unfinished merge.
我该如何解决这种情况?我不想在这个分支上提交任何东西!我也得到:
$ git status
On branch dev
Your branch and 'origin/dev' have diverged,
and have 3 and 4 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
All conflicts fixed but you are still merging.
(use "git commit" to conclude merge)
Untracked files:
(use "git add <file>..." to include in what will be committed)
首先,git merge --quit
(Git 2.23+)应该有助于摆脱进行中的合并。
第二,git pull --rebase
应该有助于在更新的origin/dev
之上重放本地提交。
然后您可以推动。