git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: How to exclude files from "git diff"

From
HLH.J. Lu <hjl.tools@gmail.com>
Date
Jan 5, 2010, 14:20 UTC
Message-ID
<6dc9ffc81001050620q55c23072p93f58c8685d77f9d@mail.gmail.com>
In-Reply-To
<20100105064509.GC19025@coredump.intra.peff.net>
On Mon, Jan 4, 2010 at 10:45 PM, Jeff King <peff@peff.net> wrote:
Show 17 quoted lines
> On Fri, Dec 18, 2009 at 09:09:15AM -0800, H.J. Lu wrote:
>
>> I have some bookkeeping files in my git repository.  How do I
>> exclude them from "git diff"? Does "git diff" support
>>
>> # git diff --exclude="foo.*.bar*"
>
> No, I don't believe there is a way to do that. You would have to do
> something like:
>
>  git diff $(git ls-files | grep -v whatever)
>
> The usual concept of "exclusion" for git is not to track files at all
> via the .gitignore mechanism.  Are these files that have content you
> really _want_ in the repository, but you just don't want to see them
> when doing some diffs? Or are they files that could not be in the
> repository at all?
Yes, I want those files in repository. They are for my personal use only.
Thanks.
-- 
H.J.
Previous: Jeff KingNext: Dmitry Potapov
Message 3 of 7 in “How to exclude files from "git diff"”
  1. H.J. LuDec 18, 2009
  2. Jeff KingJan 5, 2010
  3. H.J. LuJan 5, 2010
  4. Dmitry PotapovJan 5, 2010
  5. H.J. LuJan 5, 2010
  6. Nguyen Thai Ngoc DuyJan 5, 2010
  7. Junio C HamanoJan 5, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.