解决“琐碎冲突”的工具在git中
您知道 git 命令的任何工具/开关可以帮助我防止冲突或加速合并吗?
目前我经常遇到这样的“琐碎冲突”:
++<<<<<<< HEAD
++=======
+ onClick
+ onWakeup
++>>>>>>> 587f917...
我想这是由一些空格引起的..这很容易由人类解决,但是需要大量时间来解决所有此类冲突。
有没有什么工具可以自动解决此类冲突?
附言。我仍在学习英语,但有时我会犯一些愚蠢的错误。我正在尽我所能,用英语写问题和答案,但是如果您能编辑我的帖子,以防出现任何错误,我将非常高兴。我保证,你的努力不会白费。
Do you know any tool/switch for git commands which help me prevent conflicts or speed up merges?
Currently I often got "trivial conflicts" such this:
++<<<<<<< HEAD
++=======
+ onClick
+ onWakeup
++>>>>>>> 587f917...
I suppose that that is caused by some white-spaces.. this is very easy to solve by human, however it requires a lot of time to resolve all such conflicts.
Is there any tool which can solve this type of conflicts automatically?
PS. I am still learning English, however sometimes I am making stupid mistakes. I am doing my best, writing questions and answers in English, however I would be very glad if you will edit my post in case of any mistakes. I promise, your effort will not be wasted.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
运行 git-mergetool 来解决合并冲突。请参阅此处的手册页< /强>。 Git 有多种合并工具选项。我更喜欢kdiff3。它是开源、跨平台且易于学习的。
Git 会尽可能多地解决冲突。如果您收到该消息,则意味着 git 发现了需要人工干预才能解决的冲突。
Run
git-mergetool
to resolve merge conflicts. See the man page here. Git has several options for merge tools. I prefer kdiff3. It's open-source, cross-platform, and easy to learn.Git resolves as many conflicts as it can. If you get that message, it means git found a conflict that requires human intervention to resolve.
如果您发现自己一次又一次地解决相同的冲突,那么您可能需要使用 git rerere。
If you find yourself resolving the same conflicts again, and again, then you probably want to use git rerere.