git status与git status -u与git status -uno的区别

10

我对文档有点困惑,请帮助我纠正。

git status - 显示当前本地工作目录状态

git status -u - 显示未跟踪的文件(也是本地)

git status -uno - 不显示未跟踪的文件(也是本地)??

我不明白最后两个命令。有没有一些例子?另外,如何显示远程是否有任何更改?这样我就可以决定是否拉取了。我以为最后一个命令可以帮助我做到这一点...但显然不再可以。


你可以随时执行 git fetch,然后决定是否合并。(pull = fetch + merge) - Jonathon Reinhart
你的“also”应该是一个单独的问题,但已经在其他地方得到了回答,例如:https://dev59.com/w3A75IYBdhLWcg3wf5RV。 - torek
1个回答

11

-u--untracked-files=标志用于git status命令,它需要一个额外的参数,可以是以下三个值之一:

  • no:不显示未跟踪的文件。
  • normal:显示未跟踪的文件和目录。
  • all:比normal更详细的变体。

省略额外的单词意味着与使用-unormal(或--untracked-files=normal)相同。所以normal是默认值,而no则完全禁止它们。

使用all时的额外冗长性只是枚举每个位于未跟踪目录内的文件:

$ 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

通常情况下,-u(即-unormal)对git status没有影响。但是,如果您更改了默认设置(例如通过将status.showUntrackedFiles设置为no),-u将使git status显示未跟踪的文件,即覆盖修改后的默认值。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接