How to Check Git Status: Simple Guide to git status Command
Use the
git status command to see the current state of your Git repository. It shows which files are staged, unstaged, or untracked, helping you understand what changes are ready to be committed.Syntax
The basic syntax of the git status command is simple and does not require any arguments. You can run it inside any Git repository folder.
git status: Shows the current status of your working directory and staging area.
bash
git status
Example
This example shows how to use git status in a repository where some files are modified and some are untracked. It helps you see what changes are staged for commit and what files are new or changed.
bash
$ git status On branch main Your branch is up to date with 'origin/main'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: example.txt Untracked files: (use "git add <file>..." to include in what will be committed) newfile.txt no changes added to commit (use "git add" and/or "git commit -a")
Output
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: example.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
newfile.txt
no changes added to commit (use "git add" and/or "git commit -a")
Common Pitfalls
Some common mistakes when using git status include:
- Expecting
git statusto show committed changes instead of staged or unstaged changes. - Not running
git statusinside a Git repository folder, which causes an error. - Confusing untracked files with ignored files (ignored files do not show up in
git status).
Always make sure you are in the right folder and understand the difference between staged, unstaged, and untracked files.
bash
Wrong usage example: $ git status /some/other/folder fatal: not a git repository (or any of the parent directories): .git Right usage example: $ cd my-git-repo $ git status # shows status of current repo
Quick Reference
Here is a quick summary of what git status shows:
| Status Type | Description | What to do |
|---|---|---|
| Changes to be committed | Files staged and ready for commit | Use git commit to save changes |
| Changes not staged for commit | Modified files not yet staged | Use git add <file> to stage |
| Untracked files | New files not tracked by Git | Use git add <file> to start tracking |
| Ignored files | Files ignored by .gitignore | No action needed, they don't appear in status |
Key Takeaways
Run
git status inside your Git repository folder to see current changes.git status shows staged, unstaged, and untracked files clearly.Use
git add to stage changes before committing.Make sure you are in the correct folder to avoid errors.
Understanding
git status helps you manage your commits effectively.