sevo sevo - 9 months ago 54
Git Question

How to ask git if and where given deleted hunk lives now?

When merging, I often have modified code that is now "deleted". However it may have been moved somewhere else. How can I find out where?

Example: I change one line in a function

defined in file
. Next, I merge with tree that this function is now moved to file
(and possibly also changed one line). In
the conflict markers say "this hunk was deleted".


Assuming your branch is mybranch and the main tree is master, you could do git diff mybranch...master. This will show you all changes between the two branches using their nearest common ancestor commit as a reference point.

In the diff, you can search for your file to see what happened to it.

For more details see git help diff.