10

I am slightly confused by the documentation. Kindly, correct me.

git status - show the current local working directory status

git status -u - show untracked files (also local)

git status -uno - show no untracked files (also local) ??

I don't understand the last two. Any examples? Also, how do we show whether there are any changes remotely? So that I can decide whether to pull or not. I thought the last command helped me do that.. but apparently not anymore.

Grateful
  • 9,685
  • 10
  • 45
  • 77
  • You can always `git fetch`, and then decide whether to merge or not. (pull = fetch + merge) – Jonathon Reinhart Oct 26 '16 at 01:52
  • Your "also" deserves to be a separate question, but is already answered elsewhere, e.g., http://stackoverflow.com/questions/3258243/check-if-pull-needed-in-git – torek Oct 26 '16 at 01:57

1 Answers1

11

The -u or --untracked-files= flag to git status takes an additional parameter that is one of three values:

  • no: do not show untracked files
  • normal: show untracked files and directories
  • all: a more-verbose variant of normal

Omitting the additional word means the same as using -unormal (or --untracked-files=normal). So normal is the default, while no suppresses them entirely.

The additional verbosity with all simply takes the form of enumerating every file within an untracked directory:

$ git status
...
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    weeble/

no changes added to commit (use "git add" and/or "git commit -a")
$ git status -uall
...
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    weeble/file1
    weeble/file2

Normally, -u (aka -unormal) has no effect on git status. However, if you change your defaults (by, e.g., setting status.showUntrackedFiles to no), -u will make git status display untracked files, i.e., override your modified default.

torek
  • 448,244
  • 59
  • 642
  • 775