How to show the current state of a repository?
git status
To show the current state of your working directory and staging area use git status
. If your current local branch is linked to a remote branch, then git status
will tell you if your local branch is behind or ahead by any commits.
git status
On branch main
Your branch is ahead of 'origin/main' by 2 commits.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git restore --staged..." to unstage)
modified: README.md
Changes not staged for commit:
(use "git add..." to update what will be committed)
(use "git restore..." to discard changes in working directory)
modified: README.md
See git status to learn more about it.