LoginSignup
20
17

More than 5 years have passed since last update.

gitがignoreしているファイルを調べたい

Last updated at Posted at 2015-05-31

Show ignored files in git - Stack Overflowによれば、gitignoreで無視されているファイルを調べるにはいくつかコマンドがあるらしい。

check-ignoreコマンド

zshだとうまく動いた。bashは4以上じゃないとだめらしい。

$ git check-ignore **/*
Godeps/_workspace/pkg
Godeps/_workspace/pkg/linux_amd64
Godeps/_workspace/pkg/linux_amd64/golang.org
Godeps/_workspace/pkg/linux_amd64/golang.org/x
Godeps/_workspace/pkg/linux_amd64/golang.org/x/tools
Godeps/_workspace/pkg/linux_amd64/golang.org/x/tools/cover.a
cover.out

cleanコマンド

cleanはトラックされてないファイルを取り除くコマンドだが、取り除く予定のものを調べることができる。

$ git clean -ndX
Would remove .vagrant/
Would remove Godeps/_workspace/pkg/
Would remove cover.out

statusコマンド

statusコマンドでも調べられる。

$ git status --ignored -s
!! .vagrant/
!! Godeps/_workspace/pkg/
!! cover.out
20
17
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
20
17