Shows commit logs.
git log is intended for creating release announcements. It groups each commit by author and displays the first line of each commit message. This is an easy way to see who’s been working on what.
Show insertions and deletions to each file
--stat option displays the number of insertions and deletions to each file altered by each commit (note that modifying a line is represented as 1 insertion and 1 deletion). This is useful when you want a brief summary of the changes introduced by each commit.
git log --stat
Show actual changes
If you want to see the actual changes introduced by each commit, you can pass the
-p option to
git log. This command is very useful due to the fact that it shows details of what and when things changed over time.
git log -p
--graph option draws an ASCII graph representing the branch structure of the commit history. This is commonly used in conjunction with the
--decorate commands to make it easier to see which commit belongs to which branch.
git log --graph --oneline --decorate
Show certain number of commits
git log -n // show last 5 commits git log -5
Show commits by author
--author displays commits per specific author
git log --author="folaulau"
Get commit differences
This command is particularly useful when you use branch references as the parameters. It’s a simple way to show the differences between 2 branches.
git log master..another-branch // show commits that in feature but not in master git log master..feature
Note that if you switch the order of the range (
feature..master), you will get all of the commits in
master, but not in
git log outputs commits for both versions, this tells you that your history has diverged.