Situation:
- Cut git branch
- While I’m on this branch, I need to change a few lines in
config-blah-blah.yaml
for a very particular reason. Say, a change in database credentials to connect to a database specific to testing the changes on this branch. - Changes to that config file are very temporary and should not go back to the
main
branch. Fine fine fine, but it’s 😤 annoying that it’ll sit there as a changed file begging to be accidentally swallowed up by agit add .
- Solution!
git update-index --assume-unchanged "config-blah-blah.yaml"
😍
Isn’t that what .gitignore
is for? Kinda, except that if I change the .gitignore
file to ignore the file on this branch, the change to .gitignore
risks going back to main
, which would be an even bigger problem than the config file going to main. Not useful here. The “assume unchanged” situation is way cleaner.
Shout out to Nate Roling who pointed me to a blog post by Nick Raphael that had the answer.
Leave a Reply