1
我有修改過的webroot/wp-config.php文件,但是對於obvieus原因我不想提交它。我不想污染全球混帳配置(.IGNORE),所以我已經添加了文件Git本地忽略文件
的.git /信息/排除
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
webroot/wp-config.php
,我已經運行
git update-index --assume-unchanged webroot/wp-config.php
但仍然當我運行git狀態時,我看到webroot/wp-config.php在「要更改的提交」中進行了修改。
# On branch develop
# Your branch is ahead of 'origin/develop' by 8 commits.
#
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: webroot/wp-config.php
# modified: webroot/wp-content/themes/wp-intouch/functions/twitteroauth.php
#
PS。我也嘗試過--skip-worktree,但結果相同。
git update-index --skip-worktree webroot/wp-config.php
PS2。 Windows 7的&混帳1.7.11.msysgit.1
當你有更改被提交時,更改已經是git add-ed,正如它在'git status'輸出中說的 - 你可以使用'git reset'來「un-stage 」。之後,您的排除條目將保持文件不被重新添加,除非您明確覆蓋。 – torek