接受git中的所有合并冲突 [英] Accept all merge conflicts in 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屋!