如何解决 git 中的分歧?

how to resolve diverge in git?

我无法解决工作副本中的问题: 早些时候我拉了它并自动合并了几个文件,然后它们出现在我没有提交的暂存区域中。我现在通过 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 pull --rebase 应该有助于在更新的 origin/dev.

之上重播您的本地提交

然后就可以推送了。

OP BitFreak made it work () 与:

git push --abort
git pull --rebase