如何解决git状态“未合并的路径:"? [英] How to resolve git status "Unmerged paths:"?

查看:183
本文介绍了如何解决git状态“未合并的路径:"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将分支dog 合并到animal.当我提交时,我得到以下信息:

I merged branch dog into animal. When I go to commit, I get the following:

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 分支有我想要的更改.

I had different directory names and file names in each branch. The animal branch has the changes that I want.

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

When I go to reset the head, it doesn't work. And when I go to take any other git action (remove, checkout, etc), I get a path not found error.

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

What commands do I need to execute to resolve this?

推荐答案

您需要做的就是:

# 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状态“未合并的路径:"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆