1

When I have a merge conflict like:

<<<<<<< HEAD
    some code
=======
     other code
>>>>>>> branch-name

is there a way to see date of last commit that affected some code and date of other commit that last affected other code?

mmmm
  • 607
  • 6
  • 14
  • You want like a `git blame` but for those two specific lines and their branches? – Schwern Mar 25 '21 at 18:37
  • Thanks Schwern. Yes, ideally some tool that would add latest git blame info for the specific lines and their branches to each merge conflict would be great, but your answer solves my question. – mmmm Mar 25 '21 at 19:03
  • 1
    For that, look into [`git-mergetool`](https://www.git-scm.com/docs/git-mergetool). It lets you use a 3rd party program, possibly a script of your own making, to resolve merge conflicts. I don't know of one which does what you want off the top of my head, maybe you can find one. – Schwern Mar 25 '21 at 19:05

1 Answers1

1

Yes, run git blame on both branches you're merging.

If the conflict is on some.txt and you're merging A into B you'd run git blame A -- some.txt and git blame B -- some.txt. That will tell you the commit ID, author, and date of the last change to the lines.

Schwern
  • 153,029
  • 25
  • 195
  • 336