I have a large file where, somewhere in the middle, there is a function that I know has been modified several times. git annotate
or blame
will show the most recent commit for each line but if I'm right, it will show only the most recent one, not a list of other commits that affected that line before.
So is there a command in Git where I could say something like show me commits that affected lines 250..260 in file XYZ?
On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.
Git stores the complete history of your files for a project in a special directory (a.k.a. a folder) called a repository, or repo.
What does git log do? The git log command displays all of the commits in a repository's history. By default, the command displays each commit's: Secure Hash Algorithm (SHA)
As suggested in one of the comments in Git - how do I view the change history of a method/function?, doing
git gui blame <file>
and then right-clicking a line and selecting Blame Parent Commit does what I need.
phpStorm can do this. Select the lines -> right-click -> Git -> Show History for Selection
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