If you ever edit versioned files such as configuration files that are usually shared but require a slight modification for your dev machine, you should consider excluding those files locally.
If you edit .gitignore the files in question will be ignored on every dev machine. You probably do not want that. Instead consider the following:
First add the files in question to the file at .git/info/exclude. This file is formatted just like .gitignore.
Example:
```
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
config/database.yml
```
If your file already contains unstaged changes you may need to run:
`git update-index --skip-worktree [<file>...]`
Some online sources will tell you to use this command:
`git update-index --assume-unchanged [<file>...]`
Instead I recommend using `--skip-worktree`. The difference between the two is well summarized here:
> --assume-unchanged assumes that a developer should not change a file. This flag is meant for improving git's performance for non-changing folders like SDKs. This allows git to skip these folders when checking which files changed on the local machine.
> --skip-worktree is useful when you instruct git not to touch a specific file ever because developers are likely to change if. For example, if the main repository upstream hosts some production-ready configuration files and you don’t want to accidentally commit changes to those files, --skip-worktree is exactly what you want.