How to ignore new changes to a tracked file with git?
This question already has an answer here:
If I understand well you want filename
to be in the git repository. However you don't want to be notified of new changes to filename
. You can do this using this command:
git update-index --assume-unchanged <filename>
If you wanna start tracking changes again run the following command:
git update-index --no-assume-unchanged <filename>
additional info: editing .gitignore will only ignore files so they will not be added to the git repository. However files that are tracked already will not be ignored.
文件已被追踪,现在你想忽略这些文件。
git rm --cached filename
echo "filename" >> .gitignore
git add .gitignore
git commit -m 'Removes filename file and adds it to gitignore.'
链接地址: http://www.djcxy.com/p/23400.html
下一篇: 如何忽略用git跟踪文件的新变化?