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

Re: Excluding files from git-diff

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Oct 17, 2008, 15:18 UTC
Message-ID
<48F8ACC2.1010903@drmicha.warpmail.net>
In-Reply-To
<20081017145313.GA23471@eriks>
Erik Hahn venit, vidit, dixit 17.10.2008 16:53:
> I'm currently working on a script whose developer does not use
> git. Hence, when I mail him the patch, I don't want to include the
> .gitignore file. Is it possible to exclude a file from git-diff (except
> not adding it to git, of course?)

Am I right in assuming that by "script" you mean a manuscript consisting of several files, rather than a single script (programme in scripting language)? In any case:

git diff commit1 commit2 file

gives you the diff for "file" between those commits, so if you're really interested in one file that's the way to go; you can also specify more than one file here.

On the other hand, your .gitignore probably doesn't change that often, so that it shouldn't show up in the diff after that anyways. Or put it in .git/info/excludes.

Cheers, Michael

Previous: Johannes SchindelinNext: Christian Jaeger
Message 4 of 12 in “Excluding files from git-diff”
  1. Erik HahnOct 17, 2008
  2. Raphael ZimmererOct 17, 2008
  3. Johannes SchindelinOct 17, 2008
  4. Michael J GruberOct 17, 2008
  5. Christian JaegerOct 17, 2008
  6. Eric RaibleOct 17, 2008
  7. Christian JaegerOct 18, 2008
  8. Jeff KingOct 18, 2008
  9. Christian JaegerOct 18, 2008
  10. Jeff KingOct 18, 2008
  11. Jeff KingOct 18, 2008
  12. Anders MelchiorsenOct 17, 2008

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.