Home·Terminal commands

git status

git

Usage

git status [-sb] [-uall]

Shows what is staged, changed and untracked; untracked files are collapsed into folder names unless you add -uall.

Common flags

FlagMeaning
-sshort two-column format
-bshow the branch line, used as -sb
-ualllist untracked files one by one instead of folding folders
--ignoredalso list what .gitignore hides
-vappend the staged diff
--porcelainstable machine format for scripts

Examples

git status -sb

one line per change plus the branch and its upstream

git status -uall

names every untracked file inside new folders

git status --porcelain

output a script can parse without surprises

The confusion is that undo has several shapes — moving where a branch points is not the same as adding a commit that reverses it.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does git status do?

Shows what is staged, changed and untracked; untracked files are collapsed into folder names unless you add -uall.

Q. How do I type it?

git status [-sb] [-uall] — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

6 are listed here; the full set is in man git. This command sits under git.

Related commands

man page: man git-status