接受git中的所有合并冲突 [英] Accept all merge conflicts in git

查看:301
本文介绍了接受git中的所有合并冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图进行合并,并且存在一系列冲突。这是所有生成的文件,所以我想要做的是基本上说忽略所有合并冲突,并检查从我自己的回购一切。

我试过

p>

  git checkout。 --ours 
git add -A
git com -a

我错误,因为仍然有未合并路径桶中的文件。如何处理这个问题?



谢谢!

解决方案

对隐藏冲突非常谨慎 - 你几乎不得不明确地检查一个冲突的文件,让它知道它是固定的。对于 git add 来说,没有一个 -f 样式选项让它知道你确实是这个意思,这似乎很奇怪,但是这里有一个别名,我可以帮助它:

  add-unmerged = \ 
!f() {git ls-files --unmerged | cut -f2 | sort -u;}; git add`f`

额外提示:如果您将git add更改为$ EDITOR,您现在有 edit-unmerged ,用于编辑所有冲突的文件!


I'm trying to do a merge and there's a bunch of conflicts. It's all generated files so what I want to do is basically say "ignore all merge conflicts, and check everything in from my own repo".

I've tried

git checkout . --ours
git add -A
git com -a

It gives me an error though because there are still files in the "unmerged paths" bucket. How do I handle this?

Thanks!

解决方案

Git commands are very wary of hiding conflicts - you pretty much have to explicitly check in a conflicted file to let it know that it's fixed. It does seem odd that there's not a -f style option for git add to let it know you really mean it, but here's an alias that I have which will help:

add-unmerged = \
    "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"

Bonus tip: if you change "git add" to $EDITOR, you now have edit-unmerged, for editing all the conflicted files!

这篇关于接受git中的所有合并冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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