git status
The "status" commmand helps you understand the current state of your local Working Copy.
It will display any modifications in your local files that you haven't committed to the repository, yet.
Additionally, it will also let you know which branch is currently active and if that branch has any unsynced commits compared to its remote counterpart.
Important Options
-b -s
Display status output in short form, including branch info. By default, the output that "status" produces is a bit verbose. If you are looking for a more compact output, the "-s" option will generate a "short" format, while making sure that branch tracking info is still included with the "-b" option.
Tip
Working Copy Status in Tower
In case you are using the Tower Git client, your Working Copy status is always right in front of you: select any modified file to see its changes in detail and simply stage it with a click!
Usage Examples
Although "git status" offers a handful of options, it's almost always used in its plain form - without any parameters. More interesting than possible parameters is the wealth of information in its output:
$ git status
On branch feature/login
Your branch is ahead of 'origin/feature/login' by 1 commit.
Changes to be committed:
(use "git restore --staged ..." to unstage)
deleted: error.html
new file: img/icon.png
Unmerged paths:
(use "git restore --staged ..." to unstage)
(use "git add ..." to mark resolution)
both modified: index.html
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git restore ..." to discard changes in working directory)
modified: imprint.html
Untracked files:
(use "git add ..." to include in what will be committed)
products.html
- "On branch..." will tell you which branch you have currently checked out as your HEAD branch.
- "Your branch is..." will tell you if there are any unsynced commits: "ahead" marks commits that you haven't pushed to the remote, while "behind" means commits that you haven't pulled down from the remote, yet.
- "Changes to be committed" lists modifications and deletions in your local files that you have already added to the staging area for the next commit.
- "Unmerged paths" are files that are in a conflict state at the moment and that you need to resolve.
- "Changes not staged for commit" are also modifications in your local files - but ones that you haven't added to the staging area, yet.
- "Untracked files" lists new files that are not yet under version control.
One set of paramaters might come in handy if you want the output to be displayed in a more compact form, using "-s -b":
$ git status -s -b
## feature/login...origin/feature/login [ahead 1]
D error.html
A img/icon.png
M imprint.html
UU index.html
?? products.html
Learn More
- Check out the chapter Working on Your Project in our free online book
- Find the full command description in the Git documentation
- More frequently asked questions about Git & version control