Lists all commits of the local repository
git log
Lists all commits each on one line (only commit identifier and commit message)
git log --pretty=oneline
Almost the same as the above command. But the commit identifier is shortened (only the first several symbols)
git log --oneline
If we are on
master
and we want to see other branch's commits
git log another_branch
After fetching new commits from remote, we can see the new commits (even if we are on
master
)
git log origin/master --oneline
Shows some abbreviated stats for each commit
git log --stat
It shows all commits in the history of branches, tags and other refs, but it does not show commits that are not reachable from any ref
git log --all
We can even specify a format of the commits history
git log --pretty=format:"%h - %an, %ar : %s"
Where:
%h
is the commit identifier
%an
- author of the commit
%ar
- how much time ego was created
%s
- message of the commit
The format result:
a11bef0 - Scott Chacon, 6 years ago : Initial commit
...
Funny format which will result in:
54d459d by VLR, which created the commit 28 hours ago with comment: some messagee
git log --pretty=format:"%h by %an, which created the commit %ar with comment: %s"