Finding which commit introduced a specific change
The obvious start when looking for a commit is to look at commit messages, which can be as simple as feeding git log output to a tool like grep:
git log | grep PATTERN
However, if what we are looking for hasn’t been recorded in the message, we need something more general.
That’s when git-bisect come in handy. It makes it possible to examine commits using binary search (also called half-interval search). This significantly reduces the number of commits we need to look at to find the final commit.
Git will simply keep offering us commits for examination to decide whether they contain our change or not, while cutting the number of commits we need to search through in half every time. We can examine commits manually, or provide a script to do it for us.
See my earlier article How to find a commit that introduced a specific change with Git Bisect.
Until next time,
Petr
P.S.: If you still haven’t mastered the command line with tools like grep, check out my ebook Modern Introduction to the Linux Command Line. It will help.