Is it somehow possible to ignore certain files during git diff? I'm specifically interested in filtering out Makefile.in, Makefile, configure (and all that auto-generated crap).
+2
A:
You can try passing a list of files to git diff
, and it will execute the diff only on those files.
Depending on how your code is setup, it can be as easy as:
git diff otherbranchname -- src/ # only give me diffs from src/
or as unsightly/complex as:
git diff otherbranchname -- $( git ls-files |
perl -lne'next if /(?:[mM]akefile(?:\.in)?|configure|whateverelse)/;print' )
# diff all files which don't match the pattern
Depending on whether the files you want to ignore are managed by Git in the current branch or not, you'll need to replace the git ls-files
with a find *
; use instead a find .
and add |.git
to the Perl expression.
Tailor this as you see fit, possibly using the directories / file names you know you'd like to diff, rather than using the git ls-files
or find
.
mfontani
2010-08-13 07:02:54
Oh, this is just pure awesome :-D Thanks
Let_Me_Be
2010-08-13 07:13:56
Untracked files won't show up in the diff, though - I'd think `ls-files` would always be plenty, unless for some reason you *want* a diff for some untracked files.
Jefromi
2010-08-13 11:39:15
A:
Regarding gitignore and autotools integration, you might be interested in git.mk: http://mail.gnome.org/archives/desktop-devel-list/2009-April/msg00211.html
elmarco
2010-08-13 09:25:19