Git:git statusコマンドでIgnored files(無視ファイル)を表示する方法

スポンサーリンク

git statusコマンドでIgnored files(無視ファイル)を表示する方法

git statusコマンドでIgnored files(無視ファイル)を表示するには--ignoredオプションを指定します。

 

オプションの説明

 --ignored[=]
     Show ignored files as well.

     The mode parameter is used to specify the handling of ignored files. It is optional: it defaults to traditional.

     The possible options are:

     •   traditional - Shows ignored files and directories, unless --untracked-files=all is specified, in which case individual files in ignored directories
         are displayed.

     •   no - Show no ignored files.

     •   matching - Shows ignored files and directories matching an ignore pattern.

     When matching mode is specified, paths that explicitly match an ignored pattern are shown. If a directory matches an ignore pattern, then it is shown,
     but not paths contained in the ignored directory. If a directory does not match an ignore pattern, but all contents are ignored, then the directory is
     not shown, but all contents are shown.

 

--ignoredオプションを指定した場合(test.objがIgnored files)

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

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

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

Ignored files:
  (use "git add -f ..." to include in what will be committed)
        test.obj

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

 

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

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

Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git restore ..." to discard changes in working directory)
        modified:   README.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")