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
| Flag | Meaning |
|---|---|
| -s | short two-column format |
| -b | show the branch line, used as -sb |
| -uall | list untracked files one by one instead of folding folders |
| --ignored | also list what .gitignore hides |
| -v | append the staged diff |
| --porcelain | stable machine format for scripts |
Examples
git status -sbone line per change plus the branch and its upstream
git status -uallnames every untracked file inside new folders
git status --porcelainoutput 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