git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Cleaning the .git directory with gc
@ 2008-04-23 23:13 Haakon Riiser
  2008-04-24  0:09 ` Russ Dill
  0 siblings, 1 reply; 6+ messages in thread
From: Haakon Riiser @ 2008-04-23 23:13 UTC (permalink / raw)
  To: git

I've recently started using git, and while experimenting with
git commit --amend, I noticed that git gc does not do what I
expected.  Example:

  $ mkdir foo && cd foo
  $ git init
  $ dd if=/dev/urandom bs=1k count=1000 of=rand.dat
  $ git add .
  $ git commit -a -m 'first rev'
  $ du -s .git
  1100    .git

1 MB file checked in, 1 MB repository.  So far, so good.

  $ dd if=/dev/urandom bs=1k count=1000 of=rand.dat
  $ git commit -a -m 'replaced first rev' --amend
  $ du -s .git
  2120    .git

At this point, I expected the --amend command to notice that
the amended commit contains a replacement for the old file,
and thus that the repository didn't grow.  I then figured that
if --amend doesn't do that by itself, git gc surely will:

  $ git gc
  $ du -s .git
  2104    .git

So, why doesn't gc remove the data from the first commit?  Is it
still accessible, even though the log doesn't show it?

Is it possible to actually replace the commit, i.e., to make it
exactly like the first commit never happend at all?  (Without
modifying the repository by hand.)

-- 
 Haakon

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

end of thread, other threads:[~2008-04-24 21:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-23 23:13 Cleaning the .git directory with gc Haakon Riiser
2008-04-24  0:09 ` Russ Dill
2008-04-24  0:32   ` David Tweed
2008-04-24  0:57     ` Shawn O. Pearce
2008-04-24  0:50   ` Shawn O. Pearce
2008-04-24 21:14     ` Haakon Riiser

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 NNTP newsgroup(s).