git log
by itself shows a basic, vanilla view of the ancestral commits of the current HEAD
.
git log -p
shows the diff of a commit.
git log -n
shows the last n commits.
git log --oneline
shows a concise view of the short hash and the commit message.
- You can stack options on
git log
, as in git log -8 --oneline
to show the last 8 commits in a condensed form.
git log --graph
shows a crude but workable graphical representation of your repository.
git log --all
shows commits on other branches in the repository, not just the ancestors of the current HEAD
.
git shortlog
shows a summary of commits, grouped by their author them, in increasing time order.
git log --author="<authorname>"
lets you search for commits by a particular author.
git log --grep="<term>"
lets you search commit messages for a particular term.
git log <path/to/filename>
will show you just the commits associated with that one file.
git log <directory>
will show you the commits for files in a particular directory.
git log --stat
shows a nice overview of the scope and scale of the change in each commit.
git log -S"<term>"
lets you search the contents of a commit’s changeset for a particular term.