git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Documentation: pruning recipe for destructive filter-branch

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 14, 2009, 01:07 UTC
Message-ID
<7vr6214yi5.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1234545279-23153-1-git-send-email-trast@student.ethz.ch>
Thomas Rast <trast@student.ethz.ch> writes:
Show 25 quoted lines
> diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt
> index 1fbbbb4..737c555 100644
> --- a/Documentation/git-filter-branch.txt
> +++ b/Documentation/git-filter-branch.txt
> @@ -339,6 +339,42 @@ git filter-branch --index-filter \
>  ---------------------------------------------------------------
>  
>  
> +
> +Checklist for Shrinking a Repository
> +------------------------------------
> +
> +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:
> +
> +* 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 (in this order).  This is a very destructive
> +approach, so *make a backup* or go back to cloning it.  You have been
> +warned.
Sounds sane so far and even somewhat amusing.
Show 6 quoted lines
> +* Make sure you really removed all variants of a filename, if a blob
> +  was moved over its lifetime.  `git log \--follow \--all \-- foo` can
> +  help you find renames.
> +
> +* Make sure you really filtered all refs: use `\--tag-name-filter cat
> +  \-- \--all` when calling git-filter-branch.

Don't these two apply equally to "git clone" approach? Only the remaining four are specific to in-place pruning, if I am reading this correctly.

Show 21 quoted lines
> +* Make sure you 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`.
> +
> +* Repack to remove packed objects with `git repack -ad`.
> +
> +* Prune unpacked unreferenced objects with `git prune \--expire=now`.
> +
> +
>  Author
>  ------
>  Written by Petr "Pasky" Baudis <pasky@suse.cz>,
> -- 
> 1.6.2.rc0.274.g97213
>
> --
> 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: Thomas RastNext: Jan Krüger
Message 2 of 17 in “Documentation: pruning recipe for destructive filter-branch”
  1. Documentation: pruning recipe for destructive filter-branchThomas Rast, Feb 13, 2009
  2. Junio C HamanoFeb 14, 2009
  3. Jan KrügerFeb 14, 2009
  4. Johannes SchindelinFeb 14, 2009
  5. Jan KrügerFeb 14, 2009
  6. Johannes SchindelinFeb 14, 2009
  7. Documentation: pruning recipe for destructive filter-branchThomas Rast, Feb 14, 2009
  8. Johannes SchindelinFeb 14, 2009
  9. Junio C HamanoFeb 14, 2009
  10. Documentation: pruning recipe for destructive filter-branchThomas Rast, Feb 14, 2009
  11. gc: make --prune useful again by accepting an optional parameterJohannes Schindelin, Feb 14, 2009
  12. Thomas RastFeb 14, 2009
  13. Johannes SchindelinFeb 14, 2009
  14. gc: make --prune useful again by accepting an optional parameterJohannes Schindelin, Feb 14, 2009
  15. Thomas RastFeb 14, 2009
  16. Junio C HamanoFeb 15, 2009
  17. Jan KrügerFeb 14, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.