git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Keeping <john@keeping.me.uk>
To: "LongChair ." <longchair@hotmail.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: how do I ignore a directory for diff
Date: Sun, 5 Apr 2015 13:17:05 +0100	[thread overview]
Message-ID: <20150405121705.GE21452@serenity.lan> (raw)
In-Reply-To: <BLU168-W455AD13F694F68E77DFD0EB4FF0@phx.gbl>

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).

  reply	other threads:[~2015-04-05 12:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-05 11:31 how do I ignore a directory for diff LongChair .
2015-04-05 12:17 ` John Keeping [this message]
2015-04-05 14:19   ` Lionel CHAZALLON
2015-04-05 14:58     ` John Keeping

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150405121705.GE21452@serenity.lan \
    --to=john@keeping.me.uk \
    --cc=git@vger.kernel.org \
    --cc=longchair@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).