Blaming
Blaming is a tool used to determine in what commit a line was last changed, when that commit occurred, and who made that commit. Using blame, you can trace the changes of a line back to when bugs, errors, or features were implemented.
Use Cases:
Examples:
Checking the most recent change to each line of code in a file:
git blame [file-name]
As above, but for only a certain range of lines:
git blame -L [first-line],[second-line] [file-name]
Line ranges are integers separated by a comma:
git blame -L 4,10 index.html
Checking the most recent change to each line of code in a file, flagging commits older than a certain date:
git blame --since=[date] -- [file-name]
Dates can be written in a typical date format (DD/MM/YYYY, YYYY-DD-MM, etc.) or as a string represent the desired date relative to the current date:
git blame --since='yesterday' -- index.html
Checking the most recent change to each line in a file, using a commit ID (or abbreviation of one) to start from, looking backwards:
git blame $commit^ [file-name]
The hat (^) needs to go after the commit ID in order to look backwards from that commit