2013-01-25 16 views
10

変更内容.gitignore内のファイルをgitで追跡しています。.gitignoreは、ファイル内で変更が追跡されるのを止めません。

ファイル構造:.gitignore

.gitignore 
wp-config.php 

内容:

alex$ git status 
# On branch master 
# Changes not staged for commit: 
# (use "git add <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
# modified: wp-config.php 
# 

方法:

wp-config.php 

私はwp-config.phpを変更し、私はそれが変更されていることがわかりgit statusを実行

私はこのファイルの追跡を停止するのですか?私はそれを .gitignoreに入れれば十分だろうと思った。

答えて

34

.gitignoreでは、追跡されていないファイルだけが無視されます。

ファイルが追加されると、そのファイルへの変更は無視されません。

この場合、代わりにassume-unchangedまたはskip-worktreeを使用してください。

git update-index --assume-unchanged -- wp-config.php 

または

git update-index --skip-worktree -- wp-config.php 
+0

おかげでたくさんのM8! – zaw

+0

他のファイルはどうなっていますか?このような他のファイルやフォルダはすべて追加する必要がありますか? git ignoreを追加する代わりに? – Naveenbos

関連する問題