How to Ignore Files Only Locally on GIT

Quite often you want to modify the file locally. While it can be done on the global .gitignore, it won't be flexible and would cause an issue if another team member want to allow it be be pushed on the remote repository.

For this you can modify your .gitconfig file and add following lines to the [alias] section:

ignore = update-index --assume-unchanged
unignore = update-index --no-assume-unchanged
ignored = !git ls-files -v | grep "^[[:lower:]]"

Once this has been added, to ignore file use:

git ignore [filename]

To unignore:

git unignore [filename]

To view lists of all ignored files,

git ignored