Accidentally Committed a File
If you accidentally commit files to the repo and need to stop tracking them, the best way is to use
git rm --cached path/to/file
Need to ignore changes to a local config file
This one’s useful if you want to test something locally and have to change some configuration files (but don’t want your changes to accidentally get committed and pushed live) -
git update-index --assume-unchanged path/to/file
After using this command, git won’t try to hassle you about committing changes to that particular file anymore. This won’t affect anyone else’s repo, so you have to do it on each testing machine.