git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Thomas Rast <trast@student.ethz.ch>
Cc: git@vger.kernel.org, "Jan Krüger" <jk@jk.gs>,
	"Johannes Schindelin" <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v2] Documentation: pruning recipe for destructive filter-branch
Date: Sat, 14 Feb 2009 11:29:46 -0800	[thread overview]
Message-ID: <7vab8ou89h.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 1234621328-8998-1-git-send-email-trast@student.ethz.ch

Thomas Rast <trast@student.ethz.ch> writes:

> +git-filter-branch is often used to get rid of a subset of files,
> +usually with some combination of `\--index-filter` and
> +`\--subdirectory-filter`.  If you want to physically shrink the
> +repository afterwards, you have some choices:
> +
> +* Make sure you really removed all variants of a filename, if a blob
> +  was moved over its lifetime.  `git log \--name-only \--follow \--all
> +  \-- filename` can help you find renames.
> +
> +* Make sure you really filtered all refs: use `\--tag-name-filter cat
> +  \-- \--all` when calling git-filter-branch.
> +
> +* Clone it with `git clone file:///path/to/repo`.  The clone will not
> +  have the removed objects.  See linkgit:git-clone[1].  (Note that
> +  cloning with a plain path just hardlinks everything!)
> +
> +If you really don't want to clone it, for whatever reasons, check the
> +following points instead (in this order).  This is a very destructive
> +approach, so *make a backup* or go back to cloning it.  You have been
> +warned.
> +
> +* Remove the original refs backed up by git-filter-branch: say `git
> +  for-each-ref \--format="%(refname)" refs/original/ | xargs -n 1 git
> +  update-ref -d`.
> +
> +* Expire all reflogs with `git reflog expire \--expire=now \--all`.
> +
> +* Garbage collect all unreferenced objects with `git gc
> +  \--prune-expire=now` (or if your git-gc is not new enough to have
> +  that option, `git repack -ad; git prune`).

I am sorry, but the above does not flow well.  The first two common
preparatory steps appear as if it is only for the "clone" method.

	... often used to get rid of ... and people expect the resulting
        repository to be smaller than the original, but you need a few
        more steps to actually make it smaller, because git tries hard 
        not to lose your objects until you tell it to.  First make sure
	that:

	* you really removed all...

	* you reall filtered all...

	Then, there are two ways to get a smaller repository.  A safer way
	is to clone, that keeps your original intact.

	* Clone it with ...

	If you do not want to ...

	* Remove the original refs...

	* Expire all...

  parent reply	other threads:[~2009-02-14 19:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-13 17:14 [PATCH] Documentation: pruning recipe for destructive filter-branch Thomas Rast
2009-02-14  1:07 ` Junio C Hamano
2009-02-14  1:51 ` Jan Krüger
2009-02-14  5:46   ` Johannes Schindelin
2009-02-14  6:49     ` Jan Krüger
2009-02-14 11:48       ` Johannes Schindelin
2009-02-14 14:22         ` [PATCH v2] " Thomas Rast
2009-02-14 19:12           ` Johannes Schindelin
2009-02-14 19:29           ` Junio C Hamano [this message]
2009-02-14 20:56             ` [PATCH v3] " Thomas Rast
2009-02-14 19:02       ` [PATCH] gc: make --prune useful again by accepting an optional parameter Johannes Schindelin
2009-02-14 21:33         ` Thomas Rast
2009-02-14 21:33         ` Jan Krüger
2009-02-14 22:05     ` Johannes Schindelin
2009-02-14 22:10       ` [PATCH v2] " Johannes Schindelin
2009-02-14 22:38         ` Thomas Rast
2009-02-15 19:33         ` Junio C Hamano

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=7vab8ou89h.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jk@jk.gs \
    --cc=johannes.schindelin@gmx.de \
    --cc=trast@student.ethz.ch \
    /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;
as well as URLs for NNTP newsgroup(s).