合并后查找冲突的行和作者 [英] Find conflicting lines and authors after merge
问题描述
我正在将分支feature_1合并到当前分支master中。
执行后:git merge feature_1命令我得到几个未合并的路径,那些是需要手动解决的冲突。
我想编写一个python脚本,它将遍历未合并的路径并提取导致冲突的特定行和那些的作者两个分支上的行feature_1和master。
谢谢。
什么我试过了:
到目前为止,我试图在Git对象中运行diff函数。
git mergetool
是你的朋友。
< blockquote>没有自动合并这样的东西。当两个人做出不兼容的变化时,会发生合并冲突。人类必须手动决定要保留哪些更改。要运行的命令是: git mergetool
这将显示一个突出显示冲突的编辑器。
我还建议设置一个gui来编辑更改。有很多选择,这个选项和任何选项一样好:设置并使用Meld作为你的git difftool和mergetool - Stack Overflow [ ^ ]
减少的好方法未来的冲突是所有团队成员更新其本地分支并尽可能经常合并。
Hi,
I'm merging branch "feature_1" into current branch "master".
After executing: "git merge feature_1" command I'm getting several unmerged paths, those are conflicts that needed to be resolved manually.
I would like to write a python script that will go over the unmerged paths and extract the specific lines that caused the conflict and the Authors of those lines on both branches "feature_1" and "master".
Thanks.
What I have tried:
So far i tried to run diff function in Git object.
git mergetool
Is your friend.
There is no such thing as "automatic merge". A merge conflict happens when two humans have made "incompatible" changes. A human must manually decide what changes to keep. The command to run is:git mergetool
This will bring up an editor highlighting the conflicts.
I also recommend setting up a gui to edit the changes. There are many options, this one is as good as any: Setting up and using Meld as your git difftool and mergetool - Stack Overflow[^]
A good way to reduce conflicts in the future is if all team members update their local branch AND merge as often as possible.
这篇关于合并后查找冲突的行和作者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!