【问题标题】:How to fix this merge through terminal如何通过终端修复此合并
【发布时间】:2015-02-28 18:09:42
【问题描述】:

我在本地提取了一个外部存储库到我的文件夹,该文件夹与我的个人存储库的origin master 连接。除了README.md 之外,来自外部的文件已被拉取,当我拉取时出现错误,与我的本地README.md 文件合并错误。

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

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)。

附:抱歉,如果我搞砸了一些术语 - 我只是 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,因为我通过文件夹手动删除了它们...

【问题讨论】:

  • @minitech ,太棒了!那完成了工作!欢迎您将其发布为答案,因此我可以接受它并且其他人可以受益。 @ComputerDruid,感谢您的建议!我还看到了我从工作树中清理的许多其他文件。

标签: git github merge git-merge


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2016-06-10
    • 2018-07-13
    • 1970-01-01
    • 2022-07-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-26
    相关资源
    最近更新 更多