Display the statistics of line additions and changes
git log --stat
The git log --pretty option can be specified to display the commit history in a completely different format from the default
Show each commit of spi_flash.c by line
git log --pretty=oneline spi_flash.c
Show the author and commit description for each commit of spi_flash.c
git short --pretty=oneline spi_flash.c
Show author submitter, date and other information of spi_flash.c
git full --pretty=oneline spi_flash.c
git fuller --pretty=oneline spi_flash.c
git log –format, you can customize the record format to be displayed, such output is convenient for later programming extraction analysis
git log --pretty=format:"%h - %an, %ar : %s"
Options
illustrate
%H
The full hash string of the commit object (commit)
%h
A short hash string of the commit object
%T
The full hash string of the tree object (tree)
%t
a short hash string of the tree object
%P
The full hash string of the parent object (parent)
%p
a short hash string of the parent object
%an
author's name
%ae
Author's email address
%ad
Author revision date (the format can be customized with the -date= option)
%With
Author revision date, by how long ago
%cn
Submitter's name
%this
Submitter's email address
%cd
submission date
%cr
Commit date, displayed by how long ago
%s
Submit Instructions
The author refers to the person who actually made the changes, and the committer refers to the person who finally committed this work to the repository.
When using oneline or format in combination with the –graph option, you can see a simple graph represented by some ASCII strings at the beginning, which vividly shows the branch where each commit is located and its differentiation and reversion.
Options
illustrate
-p
Displays the differences between each update in patch format.
–stat
Displays file modification statistics for each update.
–shortstat
Show only the last row count in --stat Modification Add Remove stats.
–name-only
Only show the list of modified files after submitting the information.
–name-status
Displays a list of new, modified, and deleted files.
–abbrev-commit
Only the first few characters of SHA-1 are displayed, not all 40 characters.
–relative-date
Use a shorter relative time display (eg, "2 weeks ago").
–graph
Displays an ASCII graphical representation of the branch merge history.
–pretty
Display historical commit information in other formats. Available options include oneline, short, full, fuller, and format (followed by the specified format).
Other commands for git log
Options
illustrate
-(n)
Show only the most recent n commits
–since, –after
Show only commits after the specified time.
–until, –before
Show only commits before the specified time.
–author
Show only commits related to the specified author.
–committer
Show only commits related to the specified committer.