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

Re: How to prevent Git from compressing certain files?

From
Jakub Narebski <jnareb@gmail.com>
Date
Jul 22, 2009, 20:46 UTC
Message-ID
<m3r5w8bg69.fsf@localhost.localdomain>
In-Reply-To
<4A676D4B.7040004@dirk.my1.cc>
Dirk Süsserott <newsletter@dirk.my1.cc> writes:
Show 15 quoted lines
> I'm (ab)using Git to store my media files, i.e. digicam pictures (*.jpg)
> and the like. This way I can e.g. comment a series of pictures without
> installing and learning a special purpose "Photo Archiving" tool. Gitk
> shows the roadmap!
> 
> Somewhere I read that Git isn't supposed to efficiently handle binary
> files. Of course, I don't want to merge my files, just store them with
> their history and git-push them to some "safe place".
> 
> I figured that pushing and git gc'ing both try to compress those files
> (or differences) really hard. Works great for "regular" files, but is
> pointless with jpegs.
> 
> Question: Is there a way to prevent Git from trying to compress certain
> files based on their extension?

There is _undocumented_ "delta" gitattribute, introduced by Junio C Hamano in a74db82 (Teach "delta" attribute to pack-objects., 2007-05-19), which you would have to unset.

Like this:
  == .gitattributes ==
  *.jpg   -delta
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Jakub NarebskiNext: Jeff King
Message 3 of 5 in “How to prevent Git from compressing certain files?”
  1. Dirk SüsserottJul 22, 2009
  2. Jakub NarebskiJul 22, 2009
  3. Jakub NarebskiJul 22, 2009
  4. Jeff KingJul 23, 2009
  5. Dirk SüsserottJul 23, 2009

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.