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

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

问题描述

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

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