git status: how to ignore some changes

Posted by Mr Fooz on Stack Overflow See other posts from Stack Overflow or by Mr Fooz
Published on 2010-04-20T16:25:38Z Indexed on 2010/04/20 18:33 UTC
Read the original article Hit count: 433

Filed under:

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.

© Stack Overflow or respective owner

Related posts about git-status