Git:git statusコマンドでUntracked files(未追跡ファイル)を表示しないようにする方法

スポンサーリンク

git statusコマンドでUntracked files(未追跡ファイル)を表示しないようにする方法

git statusコマンドでUntracked files(未追跡ファイル)を表示しないようにするには-unoオプションを指定します。

 

オプションの説明

 -u[], --untracked-files[=]
     Show untracked files.

     The mode parameter is used to specify the handling of untracked files. It is optional: it defaults to all, and if specified, it must be stuck to the
     option (e.g.  -uno, but not -u no).

     The possible options are:

     •   no - Show no untracked files.

     •   normal - Shows untracked files and directories.

     •   all - Also shows individual files in untracked directories.

     When -u option is not used, untracked files and directories are shown (i.e. the same as specifying normal), to help you avoid forgetting to add newly
     created files. Because it takes extra work to find untracked files in the filesystem, this mode may take some time in a large working tree. Consider
     enabling untracked cache and split index if supported (see git update-index --untracked-cache and git update-index --split-index), Otherwise you can use
     no to have git status return more quickly without showing untracked files.

     The default can be changed using the status.showUntrackedFiles configuration variable documented in git-config(1).

 

-unoオプションを指定した場合(または--untracked-files=noのように指定)

$ git status -uno
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm ..." to update what will be committed)
  (use "git restore ..." to discard changes in working directory)
        deleted:    COPYING
        modified:   Makefile
        modified:   README.md
        modified:   SECURITY.md

no changes added to commit (use "git add" and/or "git commit -a")

 

-unoオプションを指定しない場合

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add/rm ..." to update what will be committed)
  (use "git restore ..." to discard changes in working directory)
        deleted:    COPYING
        modified:   Makefile
        modified:   README.md
        modified:   SECURITY.md

Untracked files:
  (use "git add ..." to include in what will be committed)
        test.txt

no changes added to commit (use "git add" and/or "git commit -a")