Last Updated: February 25, 2016
·
430
· bassemdy

Cloned git repo ignoring versioned files

I have recently cloned a github repository and .gitignore was simply not ignoring some versioned files.

Some files in the .gitignore should not be committed to the original repository as they are configuration files.

In order to prevent these files from being committed a nice trick is to let git assume they are unchanged:

git update-index --assume-unchanged path/to/file.txt

To revert back this process use:

git update-index --no-assume-unchanged path/to/file.txt

Original source:
https://help.github.com/articles/ignoring-files