I made a fix to a file, and committed it to my git
repository.
Some time later, I found that it had regressed. I wanted to know in which commit the fix had been taken out, so I tried git bisect
and git log --all -S TERM
, where "TERM" was a string added by my fix and which appeared nowhere else in the project.
I found that git bisect
blamed an unrelated commit, and I found that git log --all -S TERM
only listed the commit in which I added TERM, and didn't list any commits as having removed it, even though it was no longer in the file at "master".
After some manual searching, I found that there had been a merge commit between two branches. One branch had my fix and one did not. The merge author had picked the branch without my fix (strange, as there was no conflict in the file).
My questions are:
- Why can
git bisect
not find merge changes? I don't see anything in the manpage about this limitation. Is there a different way to use it that will find the bad merge in the above scenario? - Why does
git log --all -S TERM
not list the merge commit? The manpage says it lists commits which "introduce or remove an instance of ". Does that merge commit not remove my string? Is there a different way to use it that will find the bad merge in the above scenario? - If
git bisect
andgit log -S
are useless in the above scenario, what is an efficient way to find the bad merge? It look me quite a long time to track down the change in question without these tools.
bisect
to find the real culprit in that case? – Headliner--ancestry-path
fromrev-list
andbisect
. I'm not sure if you can use both together, though. If you could, the first merge that wiped your change ought to get fingered. – Beichner