Loading lessons...
Inspect with Blame and Describe
Inspect with Blame and Describe
Git has more tools for digging into history.
Git blame
git blame shows who changed each line of a file and when:
git blame index.html
Each line is labeled with the commit hash, author, and date of the change. It is the go to tool for answering "who wrote this line and why?"
Limit blame
git blame -L 10,20 index.html
The -L option limits blame to lines 10 to 20.
Git describe
git describe names a commit using the nearest tag:
git describe
If your latest tag is v1.0, the output looks like v1.0-5-gabc123, meaning 5 commits after v1.0, hash abc123.
Why describe is useful
In big projects, tags like v1.0 are easier to remember than hashes. git describe connects the two, which is handy for reports and release notes.
TL;DR
git blameshows who changed each line and when.git blame -L 10,20 filelimits the range.git describenames a commit using the nearest tag.- Both tools help you understand how a file got the way it is.