The git status command shows the status of the working directory and the staging area. It list which files are staged, unstaged, and untracked.
The git status
command shows the status of the working directory and the staging area. It list which files are staged, unstaged, and untracked.
Note:
git status
output does not show you any information regarding the committed history. For this, you need to use git log.
It shows you the changes which have been staged, which haven’t, and which files aren’t being tracked. It display what’s been going on with git add
, git reset
and git commit
.
The status also include instructions for staging/unstaging files. Sample output showing the three “trees” maintained by git. the first one is your Working Directory
which holds the actual files. the second one is the Index
which acts as a staging area and finally the HEAD
which points to the last commit you’ve made.
$ git status
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new: test.txt
modified: old-test.txt
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: older-test.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
new-test.txt
It’s a good practice to check the status of your repository before committing changes so that you don’t accidentally commit something you don’t mean to.