git status command is used to display the state of the current working directory and staging area.
git status command will list staged changes, current changes. It will not list any history related information.
List Tracked and Untracked Files
We will start with a simple
git status usage. We do not provide any option. This will list tracked and untracked files in a git repository.
$ git status
We can see that files named extension.c, pass.c, and pass2.c are not tracked by the git repository. All other files are tracked and their names are not listed.
Show In Short Format
If we want to just list the tracked and untracked files and folders in a short form we can use
-s. As we can see below only the file and folder and status will be listed.
?? means untracked.
$ git status -s
From the output, we can see that only untracked file names are listed.
Show Branch Status
If we want to print also the branch status we can provide
-b option like below.
$ git status -b
We can also list current tracked and untracked files and folders in a verbose mode. We will use
$ git status -v