Reputation: 171
I am currently analysing a Git repo, and am trying to find out how code injected in a certain commit may evolve over time in subsequent commits. For example, given line 9 in commit 57176a..., what is the next commit in the master branch that modifies this line of code?
As far as I know git log
and git blame
work in the other direction: They can analyse a line in a given commit based on previous commits. However, what I would like to do is analyse a line in a given commit based on subsequent commits.
Upvotes: 7
Views: 139
Reputation: 3545
The --reverse
option for git blame
can help you. If you run this:
git blame -L 9,9 --reverse 57176a..master your_file_name
git will start from the specified commit and search forward in the history until line 9 changes. The output will show you the last commit in which the line was unchanged.
Upvotes: 6