Hiding local changes in git

So I found myself needing to make some local customisations to database.yaml and didn’t want to commit these. Turns out the solution is twofold

You don’t want to gitignore the whole file because that removes it from VCS for everyone. Instead, add the file to your local excludes file

 

vi .git/info/exclude
add config/database.yaml
:wq
 
Then run 
 
git update-index –assume-unchanged config/database.yaml
 
And voila – git status no longer includes the local mods
Advertisements