如何解决 git status“未合并路径:”?
我将分支 dog
合并到 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 操作(删除、签出等)时,我收到 path not found
错误。
我需要执行什么命令来解决这个问题?
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
I had different directory names and file names in each branch. The animal
branch has the changes that I want.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要做的就是:
All you should need to do is:
如果你的文件已经签入,并且你的文件已经被合并(但没有提交,因此合并冲突被插入到文件中),处理这种情况的另一种方法是运行:
这将切换到 HEAD,并告诉 git忘记任何合并冲突,并保持工作目录不变。然后您可以编辑有问题的文件(搜索“更新的上游”通知)。处理完冲突后,您可以运行
该命令,这将允许您以交互方式选择要添加到索引的更改。一旦索引看起来不错(
git diff --cached
),您就可以提交,然后销毁工作目录中所有不需要的更改。
Another way of dealing with this situation if your files ARE already checked in, and your files have been merged (but not committed, so the merge conflicts are inserted into the file) is to run:
This will switch to HEAD, and tell git to forget any merge conflicts, and leave the working directory as is. Then you can edit the files in question (search for the "Updated upstream" notices). Once you've dealt with the conflicts, you can run
which will allow you to interactively select which changes you want to add to the index. Once the index looks good (
git diff --cached
), you can commit, and thento destroy all the unwanted changes in your working directory.