tags:

views:

77

answers:

1

Is there a way to have git status ignore certain changes within a file?

Background

I have some files in my repository that are auto-generated (yes, I know that's typically not recommended, but I have no power to change this). Whenever I build my tree, these auto-generated files have status information updated in them (who generated them, a timestamp, etc.).

When I say git status, I'd like it to run a filter on these generated files that strips out this transient status information. I only want it to show up in the "Changed but not updated:" section of git's output if there are other, real changes.

Using the .gitattributes approach found at http://progit.org/book/ch7-2.html, I am able to get git diff to ignore these status line changes using a simple egrep filter. I'd like to get git status to also use textconv filters (or something equivalent).

I'd prefer it if merges aren't affected by any of this filtering.

A: 

You can also you filters to hide your changes from git. Specify "clean" filter that will "clean" unnecessary changes (feed Git's version of file to Git), so it will not see the change (but it still can list the file in "git status").

Details: http://stackoverflow.com/questions/2249365/better-way-of-making-git-to-turn-a-blind-eye-on-my-changes

Also see other answers to this question, they also about ignoring changes.

Vi