The Git Status command shows working tree status of your current project.It lets you which changes are staged and which is not.
This command will show the difference between your current directory and the current HEAD commit. This will show all untracked files, modified files, deleted files, except the files ignored by .gitignore files unless –ignored flag is given. This command is very useful before using git add and git commit command to avoid accidentally commit something which should not be in git repository. for example node_modules, vendor folder, bower components not needed to be in git repository on other hand we will push package.json for node_modules, bower.json for bower components and composer.json for php vendors.
Various options are available to use with git status command. Like
- -s/–short (gives the output in short format)
- -b/–branch (shows the branch and tracking info)
- -v/–verbose (In addition to name of file it will also shows the text changes in files that are staged to be commit)
- -u/–untracked-files (shows untracked files)
- –ignored (shows ignored file as well)
- –column (shows untracked file in column)
- -z (This flag will terminate entry with null rather than LF)
The output of git status command shows different codes as follow
- ‘ ‘ for unmodified
- M for modified
- A for added
- D for deleted
- R for renamed
- C for copied
- U for unmerged
GIT Status output messages also include relevant instructions for unstaged/staged files.