On Sun, Apr 05, 2015 at 11:31:54AM +0000, LongChair . wrote:
> I have been looking into ignoring a subdirectory of my tree for
> diffing with upstream.  I'll explain the situation below :
> 
> My tree is a fork of an upstream repo.  There is a specific directory
> in my tree lets call it foo/bar that i would like to ignore for diff.
> This directory includes only files that i added to my repo and is
> therefore irrelevant for diffing (i know all files in there have been
> added and are not in upstream). Having there in the diff is just
> making a lot of files to appear and that is confusing to see what is
> changed from upstream.
> 
> I have read the docs and found a way mentioning that i should add a
> line to .gitattributes with : foo/bar/* -diff
> 
> But this still lists the files in there when i'm diffing.
> 
> Is there any way to achieve this ? i cant find any clear explanation
> in the docs.

Since git-diff takes a pathspec you can use the exclude magic to exclude
certain directories like this:

        git diff upstream -- ':(top)' ':(exclude)foo/bar'

or equivalently:

        git diff upstream -- :/ ':!foo/bar'

The documentation for the pathspec syntax is in git-glossary(7).
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to