I often rebase a large open source project and there are merge conflicts where I need to figure out who made the change and when in order to decide as to which change to take. So generally what I do is that I go to both repos and look at the file and do a git blame. Is there a mergetool that will provide this info during conflict resolution. I would like to know who made and this change and when for each version. Right now I am using meld.
Asked
Active
Viewed 1,934 times
1 Answers
15
Beside gitk, you can try git blame -L '/^<<<</,/^>>>>/' -- {filename}
: this is not integrated to a mergetool, but can be done for all conflicted files first.
Then you launch mergetool.
-
This is stupidly useful and going into my regular snippets. Can it target folders too, or just a file at a time? – lilHar Apr 09 '19 at 18:22
-
1@liljoshu git blame don't work for directory, as far as I know: https://stackoverflow.com/questions/34260196/how-to-git-blame-a-directory#comment56265439_34260196. You would need to loop over files: https://stackoverflow.com/a/55573246/6309 – VonC Apr 09 '19 at 18:56
-
This is good, before I resolve each file I have to run this command. It's a shame that the mergetool cannot do this for us. – Raj Pawan Gumdal Jul 27 '21 at 06:06
-
Just realised that this shows only first conflict in the file but not all! – Raj Pawan Gumdal Jul 27 '21 at 06:41
-
1@RajPawanGumdal OK: do ask a new question illustrating the issue. That seems an interesting case. – VonC Jul 27 '21 at 06:52