The status command in git will reveal several pieces of useful information about the current status of any Git repository. It will show users the following information:
- Which files have been changed
- Which files have been staged
- Which files have been committed
- What branch you are currently on
Example usage:
git status
Link to additional documentation (https://github.com/git-guides/git-status)
-
First, open your terminal, and naviagte to a project repository.
-
Run the command:
git statusNotice that this command will tell you what branch you are currently on
-
Make a change to a file. (The change may be trivial, you can undo this change later). Save your change.
-
Run the command again:
git statusNotice that the status will show you which file was changed. The filename should be red.
-
Stage the changed file by running:
git add <filepath>You can also add all files that have been changed with
git add * -
Run the command again:
git statusNotice that the status will show you which file was staged. The filename should be green now.