git status
Checking the current status of your working directory
The git status command shows you which files have been modified, staged, or are untracked since the last commit. It's one of the most frequently used Git commands and is the quickest way to understand what state your repository is in.
To use it, make sure you're in your repository directory and type:
$ git status
You'll see output similar to:
On branch main
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: .gitignore
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)
deleted: assets/images/cheese/gorgonzola.svg
Untracked files:
(use "git add <file>..." to include in what will be committed)
assets/images/cheese/edam.svg
Understanding the output
Git groups files into three categories:
- Changes to be committed — files that have been staged with
git addand will be included in the nextgit commit. These are shown in green. - Changes not staged for commit — files that have been modified or deleted but haven't been staged yet. These are shown in red. Use
git addto stage them, orgit restoreto discard the changes. - Untracked files — new files that Git doesn't know about yet. They won't be included in commits until you add them.
To see the actual line-by-line changes in your modified files, use git diff.
Short format
The default output is quite verbose. For a compact summary, use the -s flag:
$ git status -s
A .gitignore
D assets/images/cheese/gorgonzola.svg
?? assets/images/cheese/edam.svg
The two-character codes on the left indicate the status: A for added, M for modified, D for deleted, and ?? for untracked. The first column shows the staging area status and the second shows the working directory status.
Showing branch info
Add the -b flag to include branch and tracking information at the top of the output:
$ git status -sb
## main...origin/main [ahead 2]
A .gitignore
D assets/images/cheese/gorgonzola.svg
?? assets/images/cheese/edam.svg
This tells you which branch you're on and whether you're ahead of, behind, or diverged from the remote.
Ignoring untracked files
On projects with build directories or generated files, the untracked file list can get noisy. To suppress it:
$ git status -uno
This hides untracked files entirely, so you can focus on files Git is already tracking. For a more permanent solution, add patterns to your .gitignore file so Git doesn't report them at all.
Once your changes are committed and pushed, DeployHQ can deploy them to your servers automatically — keeping your live site in sync with your repository.