17

私の中にあるファイルに加えた変更は.gitignore、git によって追跡されています。

ファイル構造:

.gitignore
wp-config.php

の内容.gitignore:

wp-config.php

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

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
#

このファイルの追跡を停止するにはどうすればよいですか? .gitignore入れるだけで十分だと思いました。

4

1 に答える 1

51

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

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

この場合、代わりにassume-unchangedorを使用する必要があります。skip-worktree

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

また

git update-index --skip-worktree -- wp-config.php
于 2013-01-25T01:29:19.760 に答える