Once upon a time, one bad guy had deleted a constant from the source code managed through our Git repository.
Nobody has noticed this for a loooong time.... until now.
Yet I want to figure out in which commit this constant is gone, and who the bad guy is.
I only know the constant's name was FOOBAR
.
Is there some better approach as git blame --reverse
?
To track down a broken commit, git gives us a very handy tool called git bisect . Git bisect does a binary search to find the broken commit.
The git bisect command is used to discover the commit that has introduced a bug in the code. It helps track down the commit where the code works and the commit where it does not, hence, tracking down the commit that introduced the bug into the code.
This will list all commits that added or removed the string FOOBAR from any file:
git log --all -p -SFOOBAR
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With