git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* how do I ignore a directory for diff
@ 2015-04-05 11:31 LongChair .
  2015-04-05 12:17 ` John Keeping
  0 siblings, 1 reply; 4+ messages in thread
From: LongChair . @ 2015-04-05 11:31 UTC (permalink / raw)
  To: git

Hello,

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.

Any help would be greatly appreciated :)

Lionel.

 		 	   		  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how do I ignore a directory for diff
  2015-04-05 11:31 how do I ignore a directory for diff LongChair .
@ 2015-04-05 12:17 ` John Keeping
  2015-04-05 14:19   ` Lionel CHAZALLON
  0 siblings, 1 reply; 4+ messages in thread
From: John Keeping @ 2015-04-05 12:17 UTC (permalink / raw)
  To: LongChair .; +Cc: git

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how do I ignore a directory for diff
  2015-04-05 12:17 ` John Keeping
@ 2015-04-05 14:19   ` Lionel CHAZALLON
  2015-04-05 14:58     ` John Keeping
  0 siblings, 1 reply; 4+ messages in thread
From: Lionel CHAZALLON @ 2015-04-05 14:19 UTC (permalink / raw)
  To: John Keeping; +Cc: git

Hello John,

Thanks for the answer. I am also using some GUI client (smartgit). Is there any way to make this part of the repo attributes / configuration so that my git GUI would use it ? 

Lionel.

> Le 5 avr. 2015 à 14:17, John Keeping <john@keeping.me.uk> a écrit :
> 
> 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).

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how do I ignore a directory for diff
  2015-04-05 14:19   ` Lionel CHAZALLON
@ 2015-04-05 14:58     ` John Keeping
  0 siblings, 0 replies; 4+ messages in thread
From: John Keeping @ 2015-04-05 14:58 UTC (permalink / raw)
  To: Lionel CHAZALLON; +Cc: git

On Sun, Apr 05, 2015 at 04:19:50PM +0200, Lionel CHAZALLON wrote:
> > Le 5 avr. 2015 à 14:17, John Keeping <john@keeping.me.uk> a écrit :
> > 
> > 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).
> 
> Thanks for the answer. I am also using some GUI client (smartgit). Is
> there any way to make this part of the repo attributes / configuration
> so that my git GUI would use it ? 

I think you'll have to file a feature request with SmartGit if you want
support for this in their UI.

The standard way to set this up would be to create an alias that does
what you want, such as:

	git config alias.d 'diff -- :/ ":!foo/bar"'

and use "git d" instead of "git diff", but there is no way for other
programs to inherit that.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-05 14:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-05 11:31 how do I ignore a directory for diff LongChair .
2015-04-05 12:17 ` John Keeping
2015-04-05 14:19   ` Lionel CHAZALLON
2015-04-05 14:58     ` John Keeping

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