Git development
 help / color / mirror / Atom feed
From: "Marcel M. Cary" <marcel@oak.homeunix.org>
To: geoffrey.russell@gmail.com
Cc: git@vger.kernel.org
Subject: Re: purging unwanted history
Date: Tue, 18 Nov 2008 06:28:55 -0800	[thread overview]
Message-ID: <4922D127.1020305@oak.homeunix.org> (raw)
In-Reply-To: <93c3eada0811161626h69929cd7va3fa4007a2341bae@mail.gmail.com>

Geoff,

I'm able to prune history with git filter-branch.  For example, to throw
away history on the current branch before commit
171d7661eda111d3e35f6e8097a1a3a07b30026c, I tried:

git filter-branch --parent-filter '
    if [ $GIT_COMMIT = 171d7661eda111d3e35f6e8097a1a3a07b30026c ]; then
        echo "";
    else
        read line;
        echo $line;
    fi'

I found the diff between that commit and it's rewritten version was
empty, and diffs to subsequent commits looked sane.  It took an hour on
the git repository with about 16k commits.  I probably should have
excluded all the commits I didn't want to keep to reduce processing time.

However, after deleting all but the rewritten branch and cloning the
repository, I didn't notice any decrease in the size of .git/, so I'm
not sure why you'd want to do that.  Also, all the remaining commitIDs
changed so any previous clones would have a tough time merging with yours.

Another possibility whose results might be similar in runtime and
repository size would be to run git rebase --interactive and squash all
the commits together before the ones you want to keep.

Marcel


Geoff Russell wrote:
> I have a repository with 5 years worth of history, I only want to keep
> 1 year, so I want to purge the
> first 4 years. As it happens, the repository only has a single branch
> which should
> simplify the problem.
> 
> Cheers,
> 
> Geoff Russell
> 
> P.S. Apologies, but I've asked this question before but didn't get an
> answer which
> I understood or which worked, so perhaps my description of the problem
> was faulty. This
> is a second attempt.
> --
> 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
> 

      parent reply	other threads:[~2008-11-18 14:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-17  0:26 purging unwanted history Geoff Russell
2008-11-17  2:24 ` Björn Steinbrink
2008-11-17  2:27   ` Björn Steinbrink
2008-11-17  3:03     ` Geoff Russell
2008-11-18 14:28 ` Marcel M. Cary [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4922D127.1020305@oak.homeunix.org \
    --to=marcel@oak.homeunix.org \
    --cc=geoffrey.russell@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox