Commit Log

Learn to see the history of the commit snapshots.

The log shows the history of the commit snapshots. Some of the log options are shown below:

 $ git log --oneline --graph --decorate --color --all 

Options for the git log command

  • The --oneline option shows the simplified version.
  • The --graph option shows the commit relationship path on the left so that the log sequence becomes a committed path.
  • The --all option shows all branches, including the remote branch. Otherwise, git log only shows the current branch.
  • The --decorate option shows the branch pointers to the commits. In the latest Git version, the --decorate option is on by default.
  • The --color option, as the name suggests, makes the log output colorful and easier to read. In the latest Git version, the --color option is on by default in some systems.

Run the git log command with different flags

First, we run git log alone, then add flags one by one to understand each function, and then try in different pairs. Usually, they’re used all together for ease.

Now, try to run these commands in the terminal below:

Get hands-on with 1200+ tech skills courses.