Re: Trying to use git-filter-branch to compress history by removing large, obsolete binary files

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Elijah Newren
Date: Sunday, October 7, 2007 - 5:09 pm

On 10/7/07, Alex Riesen <raa.lkml@gmail.com> wrote:

What version of git are you running?  I reran all the steps to which
you responded (repeated below for clarity) with git-1.5.3.3 and still
get 11MB.  Also, you must have different filesystem extents than me
since an empty git repo takes 196k here[1], so I don't think any repo
is going to get down to 124k.

My understanding of the steps you suggest would work:

# Make a small repo
mkdir test
cd test
git init
echo hi > there
git add there
git commit -m 'Small repo'

# Add a random 10M binary file
dd if=/dev/urandom of=testme.txt count=10 bs=1M
git add testme.txt
git commit -m 'Add big binary file'

# Remove the 10M binary file
git rm testme.txt
git commit -m 'Remove big binary file'

# Compress the repo, see how big the repo is
git gc --aggressive --prune
du -ks .                       # 10548K
du -ks .git                    # 10532K

# Try to rewrite history to remove the binary file
git-filter-branch --tree-filter 'rm -f testme.txt' HEAD
git reset --hard

# Try to recompress and clean up, then check the new size
git gc --aggressive --prune
du -ks .                       # 10580K !?!?!?
du -ks .git                    # 10564K

# Do the stuff Alex suggests to trim the history
rm -rf .git/refs/original/
vi .git/packed-refs
# Use vi to remove the line referring to refs/original...
git reflog expire --all
git gc --aggressive --prune
du -ks .                      # Still 10564K


Thanks,
Elijah

[1] An empty git repo takes 196k for me, as can be seen by:
$mkdir tmp
$cd tmp
$git init
$du -hs .
196K    .
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Trying to use git-filter-branch to compress history by ..., Johannes Schindelin, (Sun Oct 7, 4:19 pm)
Re: Trying to use git-filter-branch to compress history by ..., Johannes Schindelin, (Sun Oct 7, 4:28 pm)
Re: Trying to use git-filter-branch to compress history by ..., Elijah Newren, (Sun Oct 7, 5:09 pm)
Re: Trying to use git-filter-branch to compress history by ..., Johannes Schindelin, (Sun Oct 7, 5:34 pm)
Re: Trying to use git-filter-branch to compress history by ..., Johannes Schindelin, (Sun Oct 7, 6:06 pm)
Re: Trying to use git-filter-branch to compress history by ..., Johannes Schindelin, (Tue Oct 9, 3:37 am)