I have a file (config.php), that is already committed to a Git repository, but I want to ignore locally, i.e. I want that file to remain in repository, but force Git to ignore any changes to it.
I put the file into .gitignore, but it is still marked as changed and Git still is attempting to commit changes to it, every time I commit something.
Any ideas, what am I missing or doing wrong?
If the file is still displayed in the status, even though it is in the .gitignore, make sure it isn’t already tracked.
If you just want to ignore it locally, you could also make it ignored by the git status:
As commented, do note that using
--assume-unchangedmight cause unwanted data loss asgit stashresets the "ignored" files to the state in upstream, undoing local changes, without a warning or saving.