How to check Git repository status

· Category: Git

Short answer

Run git status to display the current state of your working directory and staging area.

Steps

  1. Check repository status:
git status
  1. View a shorter summary:
git status -s
  1. Check status of a specific file:
git status filename.txt

Tips

  • git status -sb shows the current branch and a concise change list.
  • Use it before every commit to verify what will be included.
  • Green files are staged; red files are unstaged or untracked.

Common issues

  • Seeing many untracked files: add them to .gitignore if they should not be tracked.
  • Submodules may show dirty states; navigate into them to check their individual status.