git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Forcing git to pack objects
@ 2015-12-19  1:03 Edmundo Carmona Antoranz
  2015-12-20  2:25 ` Mikael Magnusson
  2015-12-20  7:41 ` Jeff King
  0 siblings, 2 replies; 3+ messages in thread
From: Edmundo Carmona Antoranz @ 2015-12-19  1:03 UTC (permalink / raw)
  To: Git List

Hi!

Recently I was running manually a git gc --prune command (wanted to
shrink my 2.8G .git directory by getting rid of loose objects) and I
ended up running out of space on my HD. After freaking out a little
bit (didn't know if the repo would end up in a 'stable' state), I
ended up freeing up some space and I again have a working repo...
_but_ I noticed that basically _all_ objects on my repo are laying
around in directories .git/objects/00 to ff (and taking a whole lot of
space... like the .git directory is now like 5 GBs). After running git
gc manually again it ended up taking a lot of time and the objects are
still there. Also git svn sometimes gcs after fetching and it took to
run cause of the gc execution (ended up killing it) and the files are
still there. Is it possible to ask git to put all those objects in
.pack files? Or did I mess something on my repo?

Just in case, that's a repo I use at work that's working on a windows
box (git for windows 2.6.3).

Thanks in advance.

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

* Re: Forcing git to pack objects
  2015-12-19  1:03 Forcing git to pack objects Edmundo Carmona Antoranz
@ 2015-12-20  2:25 ` Mikael Magnusson
  2015-12-20  7:41 ` Jeff King
  1 sibling, 0 replies; 3+ messages in thread
From: Mikael Magnusson @ 2015-12-20  2:25 UTC (permalink / raw)
  To: Edmundo Carmona Antoranz; +Cc: Git List

On Sat, Dec 19, 2015 at 2:03 AM, Edmundo Carmona Antoranz
<eantoranz@gmail.com> wrote:
> Hi!
>
> Recently I was running manually a git gc --prune command (wanted to
> shrink my 2.8G .git directory by getting rid of loose objects) and I
> ended up running out of space on my HD. After freaking out a little
> bit (didn't know if the repo would end up in a 'stable' state), I
> ended up freeing up some space and I again have a working repo...
> _but_ I noticed that basically _all_ objects on my repo are laying
> around in directories .git/objects/00 to ff (and taking a whole lot of
> space... like the .git directory is now like 5 GBs). After running git
> gc manually again it ended up taking a lot of time and the objects are
> still there. Also git svn sometimes gcs after fetching and it took to
> run cause of the gc execution (ended up killing it) and the files are
> still there. Is it possible to ask git to put all those objects in
> .pack files? Or did I mess something on my repo?
>
> Just in case, that's a repo I use at work that's working on a windows
> box (git for windows 2.6.3).
>
> Thanks in advance.

git repack -d should do it.

-- 
Mikael Magnusson

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

* Re: Forcing git to pack objects
  2015-12-19  1:03 Forcing git to pack objects Edmundo Carmona Antoranz
  2015-12-20  2:25 ` Mikael Magnusson
@ 2015-12-20  7:41 ` Jeff King
  1 sibling, 0 replies; 3+ messages in thread
From: Jeff King @ 2015-12-20  7:41 UTC (permalink / raw)
  To: Edmundo Carmona Antoranz; +Cc: Git List

On Fri, Dec 18, 2015 at 07:03:39PM -0600, Edmundo Carmona Antoranz wrote:

> Recently I was running manually a git gc --prune command (wanted to
> shrink my 2.8G .git directory by getting rid of loose objects) and I
> ended up running out of space on my HD. After freaking out a little
> bit (didn't know if the repo would end up in a 'stable' state), I
> ended up freeing up some space and I again have a working repo...
> _but_ I noticed that basically _all_ objects on my repo are laying
> around in directories .git/objects/00 to ff (and taking a whole lot of
> space... like the .git directory is now like 5 GBs). After running git
> gc manually again it ended up taking a lot of time and the objects are
> still there. Also git svn sometimes gcs after fetching and it took to
> run cause of the gc execution (ended up killing it) and the files are
> still there. Is it possible to ask git to put all those objects in
> .pack files? Or did I mess something on my repo?

It sounds like these objects aren't reachable from any of your refs.
That would explain:

 - why they don't get packed; we only pack reachable objects.

   There's no easy way with "git gc" or "git repack" to pack unreachable
   objects. If you drop down to the "git pack-objects" level, you can
   manually convince it to do so.

   I have a patch to add "git repack -k", which packs even unreachable
   objects (we use this at GitHub, since our routine repository
   maintenance never deletes objects). If people are interested, I can
   clean it up and post it to the list.

 - why your repo grew during the gc; packed unreachable objects are
   exploded into loose objects during a gc, so they can age and expire
   on their own (we use filesystem mtimes to determine how old they
   are).

   Git is smart enough not to explode loose objects that it is just
   going to prune in a moment.  But the default expiration time is 2
   weeks, so there's a good chance it would want to keep some of them.

   If you use "git gc --prune=now", that should prune everything
   immediately (and this is safe, as long as you know there are no
   simultaneous users of your local repository).

-Peff

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

end of thread, other threads:[~2015-12-20  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-19  1:03 Forcing git to pack objects Edmundo Carmona Antoranz
2015-12-20  2:25 ` Mikael Magnusson
2015-12-20  7:41 ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).