Re: Excluding files from git-diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 17, 2008 at 06:30:31PM +0200, Christian Jaeger wrote:

> For me, adding entries to that file does not make "git diff" or "gitk" or 
> even "git ls-files" ignore files matching the entries. Only "git ls-files 
> --others --exclude-from=.git/info/exclude" will exclude them. And "git 
> diff " and gitk don't seem to know the --exclude-from option.

What you are seeing is:

  - ls-files is plumbing, and does not do any exclusion by default. So
    you need to use the --exclude-from option, or more easily,
    --exclude-standard (which pulls in .git/info/excludes, .gitignore,
    and user-level excludes).

  - porcelain _does_ do exclusion. However, exclusion does not mean "if
    this file is tracked by git, don't include it in the diff." It
    merely means "if this file is untracked, pretend like it is not
    there." So a diff displayed by "git diff" isn't affected by
    exclusions anyway.

> Is there a way to really invert the patterns given to "git diff" or  
> alike? I.e. instead of saying "git diff -- * .somedotfile  
> .someothernongitignoredotfile" one could just say something like "git  
> diff --invert-matches -- .gitignore"? And even better, could one  
> configure some such so that it has effect on all tools by default?

No, I don't think there is a way to do that currently. I would probably
generate the file list with a shell snippet:

  git diff -- `git ls-files | grep -v .gitignore`

but obviously that is a lot more typing if this is something you are
doing frequently.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux