Inspecting a git repository

To inspecting a git repository we generally use following two command.

  1. git status.
  2. git log.

git status

git status command shows the detail of staged, unstaged and untracked files.

git status

git status command output is like below.

It is good practice to check the status of working repo before committing changes so that you do not commit something wrong.

git log

git log command shows the committed snapshots.It operates on the committed history,While git status lets you inspect the working directory.

git log

git log command output is like below.

Usage of git log

Limit the number of commits by limit.

git log -n 2