Git: Ignore changes in a working tree file
Posted on May 21st, 2009 in git | 3 Comments »
Lately, I’ve transferred all my repos over from Subversion to Git and have become familiar enough with the Git SVN bindings to even work on my work projects in Git while still being able to check-in as a regular SVN user.
I’ve found that some usual stuff Subversion would ignore in projects Git doesn’t. The Git exclude file doesn’t work here since these are files being tracked in the working tree that are just specific to your instance. After digging around, I found the proper command to ignore these files:
# ignore changes in a working tree file git update-index --assume-unchanged .classpath
3 Responses
hello! How do I get ahold of you? I couldn’t find an email address.
Here’s my bio for more background: http://andrewchenblog.com/about/
Please write me at voodoo at gmail, thanks!
Andrew
I use this when working locally on some rails projects. I edit our main controller to ignore some authentication that I don’t have access to but I don’t want to commit that. I don’t want to stash away the changes, I just want git to ignore them so I don’t accidentally commit it.
To see a list of these I use this command:
git ls-files -v | grep ^[a-z]
The -v on ls-files shows assume-unchanged files as lower case versions of the normal tags (-t shows uppercase no matter what) and then I grep for only lower case tags. If anyone has a better way of doing this please tell me :)
To make this easier to use I have an alias in my ~/.gitconfig file:
[alias]
marked-unchanged = !git ls-files -v | grep ^[a-z]
mu = !git ls-files -v | grep ^[a-z]
Now I can use this with “git marked-unchanged” or “git mu”
[...] The simple answer to this is to tell git to mark this file as “not changed”. I found this post that told me about this feature. This feature exists in order to help people with slow filesystems [...]