1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Git】ignoreされているか確認する方法

Last updated at Posted at 2022-12-17

確認方法

git status --ignoredで確認できます。

$ tree
.
├── example.txt
├── sample.txt
└── test.txt

$ cat .gitignore
/test.txt
/example.txt

$ git status --ignored
On branch main

No commits yet

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

Ignored files:
  (use "git add -f <file>..." to include in what will be committed)
        example.txt
        test.txt

nothing added to commit but untracked files present (use "git add" to track)

またgit ls-files --other --ignored --exclude-standardでも可能です。
こちらはignoreされているファイルのリストのみ出力されます。

$ git ls-files --other --ignored --exclude-standard
example.txt
test.txt
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?