Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git status vs git status -u vs git status -uno

Tags:

git

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.

like image 916
Grateful Avatar asked Oct 26 '16 01:10

Grateful


1 Answers

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.

like image 144
torek Avatar answered Sep 30 '22 21:09

torek