Ignoring Tracked Files in Git

June 9, 2010 Pivotal Labs

I occasionally run into a situation with Git where I have modified a file but have no intention of committing the change to the repository. This most often happens with computer specific configuration files. My config/database.yml in Rails projects can spend a lot of time in a dirty state if one of my dev machines has a root mysql password and the other does not.

Git will ignore untracked files that are added to .gitignore files or the .git/info/exclude file. For files that git knows about and is already tracking there is a obscure way to tell git to ignore changes to those files.

git update-index --assume-unchanged config/database.yml

When you have made changes to the file that you want to commit you’ll need to execute the inverse (--no-assume-unchanged) for git to acknowledge that the file has changed.

References:

About the Author

Biography

Previous
Sass development at the speed of Javascript
Sass development at the speed of Javascript

Surrendering to Sass I've finally gone all-out for Sass. The last thing that was holding me back was the ...

Next
Easy Insight custom reporting and analytics for Pivotal Tracker
Easy Insight custom reporting and analytics for Pivotal Tracker

If you're looking for custom reporting and analytics for your projects, Easy Insight just added integration...

×

Subscribe to our Newsletter

!
Thank you!
Error - something went wrong!