如何通过终端修复此合并

How to fix this merge through terminal

我将一个外部回购本地拉到我的文件夹,该文件夹与我个人回购的 origin master 相关联。来自外部文件的文件被拉取了,除了 README.md 并且我在拉取时遇到了一个错误,关于我的本地 README.md 文件的合并错误。

然后我做了一些工作,我想将我的更改推送到我的 repo 但得到了

Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

我删除了 readme 文件并尝试再次推送,但同样的问题。而且我不想 add --all 到单个提交,因为更改是针对不同的上下文,我想分成不同的提交。

我尝试了git checkout --ours README.md--theirs README.md,然后进行了其他操作,但仍然没有成功。

如何在没有 UI 合并工具的情况下解决这个问题,而只能通过终端? (我在本地没有未推送的提交,atm)。

P.S。对不起,如果我搞砸了一些术语 - 我只是 git.

的初学者

Git状态:

You have unmerged paths.
  (fix conflicts and run "git commit")

Changes to be committed:

    new file:   ../bday-picker.js
    new file:   ../bday-picker.min.js
    new file:   ../index.html
    ..other files

Unmerged paths:
  (use "git add <file>..." to mark resolution)

    both added:         ../README.md

现在我也在想为什么这 3 new files 列出来了,因为我通过文件夹手动删除了它们...

您的 git status 表明您已经在进行合并;在重试之前,您需要中止该合并。 运行 git merge --abort,然后再次检查 git status 并清理那里的任何东西,然后拉。