by tomhallett · 1y ago · 0 comments
- blame on file
- scroll to line 123, click on commit to see the change
- ok, that commit wasn’t the “meaningful change” I’m looking for
- click on parent commit
- browse files (for that sha)
- go to file
- click blame
- scroll to line 123 (or similar)
- repeat
Example output based on Linux kernel @ "Cregit-Linux: how code gets into the kernel": https://cregit.linuxsources.org/
I learned of Cregit recently--just submitted it to HN after seeing multiple recent HN comments (yours being one I've had open in a tab for a week to remind me! :) ) discussing issues related to line-based "blame" annotation granularity:
"Cregit-Linux: how code gets into the kernel": https://news.ycombinator.com/item?id=43451654
git log -L 120,150:filename.txt
To see all commits that have touched lines 120-150 in filename.txt, and see those lines. Gives a view into a subset of lines but won't help if the code in question moved out of the line range. git log -S <the-string>
If it’s commit messages I’m interested in: git log --grep <the-word-or-phrase>
Sometimes I want to know “all the commits that introduced a pattern”: git blame —- $(git grep -P -l 'the.*regex') | grep -P 'the.*regex'
This last one I use frequently enough that I wrote a little shell script for it, called "git-blep" (for "blame-grep")———
If there’s a function name that you’re logging, then you might get mileage from
git log -L :<the-function-name>:<the-file-name>
Though that probably would not have worked in the original author’s case.Link (not much info there): https://www.jetbrains.com/help/idea/investigate-changes.html...