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
- Check repository status:
git status
- View a shorter summary:
git status -s
- Check status of a specific file:
git status filename.txt
Tips
git status -sbshows 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
.gitignoreif they should not be tracked. - Submodules may show dirty states; navigate into them to check their individual status.