git — ignore changes
If there are changes that you need to ignore, but you can’t or doesn’t want to edit neither .gitignore_global
nor .gitignore
files, there is still hope for you. In repository there is file:
.git/info/exclude
That file has the same structure and function as .gitignore
, but version from one repository, doesn’t affect other repositories.
But if file is already tracked, there is another ways of ignoring changes:
git update-index --skip-worktree <files>
git update-index --assume-unchanged <files>
Difference is that --skip-worktree
means for git: “don’t touch, because developer should change this file for his needs”. While --assume-unchanged
means for git: “you don’t have to check files, because it shouldn’t be changed by developer”.
And undo:
git update-index --no-skip-worktree <files>
git update-index --no-assume-unchanged <files>
This will help you finding what files are marked with git update-index --skip-worktree
and git update-index --assume-unchanged
respectively:
git ls-files -v | grep '^S'
git ls-files -v | grep '^h'