Created
October 10, 2014 16:56
-
-
Save ideodora/c36d5eba5de3d93edb90 to your computer and use it in GitHub Desktop.
既に管理下のファイルを.gitignoreに追加して無視したい時
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ただ、既に大量のファイルが登録されている場合、これをひとつひとつやっていたら大変なので、以下のように git ls-files の -i と --exclude-from オプションを使って、まとめて除外するとらくです。 | |
git rm --cached `git ls-files --full-name -i --exclude-from=.gitignore` | |
#-i は --ignored の略で、Git に登録されているファイルの内、次に指定する方法で無視するファイルの一覧を出力します。 | |
#--exclude-from=<ignore-file> を指定すると、<ignore-file> に記述されたパターンにマッチするファイルを、無視するファイルとして扱います。 | |
#--exclude-standard を指定すると、Git が標準で無視リストとして扱う .gitignore や .git/info/exclude などのファイルに書かれたパターンにマッチするファイルを、無視するファイルとして扱います。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment