~/hackweb.dev
Viewing Status and History
Quiz
...

Viewing Status and History

beginner · updated Tue Sep 08 2026Contribute

Track your repo state with git status and browse history with git log.

Viewing Status and History

Git provides commands to check the state of your repository and view the history of changes.

Checking Status

See what’s changed, staged, or untracked:

git status
# On branch main
# Changes not staged for commit:
#   modified:   file.txt
#
# Untracked files:
#   newfile.txt

Viewing Commit History

See all commits with full details:

git log
# commit a1b2c3d (HEAD -> main)
# Author: Your Name <[email protected]>
# Date:   Mon Sep 8 12:00:00 2026
#
#     Add login page

Compact Log View

Show one commit per line:

git log --oneline
# a1b2c3d Add login page
# b2c3d4e Initial commit

Limit results:

git log --oneline -5

Visualizing Branches

See branch relationships:

git log --graph

Best Practices

  • Check status before committing
  • Use git log --oneline for quick overview
  • Use git log --graph to understand branch structure
  • Review history regularly to understand project evolution

Common Mistakes

  • Forgetting to check status before committing
  • Not understanding the difference between staged and unstaged changes
  • Ignoring untracked files that should be committed
  • Not using branches for experimental work