Prevent config-file from showing up as modified in git after commiting it once

StackOverflow https://stackoverflow.com/questions/23607117

  •  20-07-2023
  •  | 
  •  

Question

I commited a basic version (without passwords etc.) of my config-file to a git repo. Now I want it to not show up below "changes not staged for commit" as modified anymore so I can just use git add * without worrying that I commit my user-data.

Adding the file in question to .gitignore didn't help.

Was it helpful?

Solution

Try git update-index --assume-unchanged <path>.

But it's important to note, that a hard reset will revert this (stash for example makes a hard reset).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top