git log -1 --merges --ancestry-path <commit-A>..HEAD -- path/to/fileUse this to identify the first merge commit on the mainline (first-parent path) from <commit-A> to HEAD that touched a specific file. Especially useful when a line disappears due to merge conflict resolution and isn't visible with -S or -G.