git - 如何解决 git status "Unmerged paths:"?

标签 git merge git-merge git-status

我将分支 dog merge 到 animal 中。当我提交时,我得到以下信息:

Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution
both deleted:       ../public/images/originals/dog.ai
added by them:      ../public/images/original_files/dog.ai

我在每个分支中有不同的目录名和文件名。 animal 分支具有我想要的更改。

当我去重置头部时,它不起作用。当我执行任何其他 git 操作(删除、 checkout 等)时,我会收到一个path not found 错误。

我需要执行什么命令来解决这个问题?

最佳答案

您需要做的就是:

# if the file in the right place isn't already committed:
git add <path to desired file>

# remove the "both deleted" file from the index:
git rm --cached ../public/images/originals/dog.ai

# commit the merge:
git commit

关于git - 如何解决 git status "Unmerged paths:"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3207029/

相关文章:

git - "git --bare init"不只产生一个 .git 目录

python - 根据另一个文件的 zip 合并更新 csv 文件中的城市

Git 工作流程 - 从发布分支恢复功能分支

git - 如何 merge 两个本地存储库

git - 如何让git在 merge 时忽略目录

git - 当本地主分支上没有工作时, git pull --rebase 是否与 git pull 相同?

GIT:不显示我已推送到存储库的文件

git - 使用 git branch 的 heroku 令人困惑!

.net - 在我使用 NuGet 的项目上使用 github

Python:以最有效的方式合并许多数据框