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

Re: Truncating and cleaning a imported git repositary to make it more usable

From
Mike Hommey <mh@glandium.org>
Date
Mar 28, 2008, 20:44 UTC
Message-ID
<20080328204452.GA15737@glandium.org>
In-Reply-To
<47ED204E.3020602@viscovery.net>
On Fri, Mar 28, 2008 at 05:43:58PM +0100, Johannes Sixt wrote:
Show 24 quoted lines
> Alex Bennee schrieb:
> > On Fri, Mar 28, 2008 at 3:52 PM, Alex Bennee <kernel-hacker@bennee.com> wrote:
> > 
> >>  ajb@pitcairn:/export/git/fresh.git$ git-filter-branch --tree-filter
> >>  'rm -rf big_dira big_dirb' dev-branch
> >>  warning: refname 'dev-branch' is ambiguous.
> >>  Which ref do you want to rewrite?
> > 
> > Ignore me. Not sure why but:
> > 
> > git-checkout dev-branch
> > git-filter-branch --tree-filter  'rm -rf big_dira big_dirb' HEAD
> 
> You really shouldn't do it this way, unless you do it on a ramdisk. Better
> use an --index-filter. This is modeled after the last example in the man
> page (and, of course, untested):
> 
> git filter-branch --index-filter \
>         'git ls-files -s |
> 	 grep -v "	big_dira" |
> 	 grep -v "	big_dirb" |
>                 GIT_INDEX_FILE=$GIT_INDEX_FILE.new \
>                         git update-index --index-info &&
>          mv $GIT_INDEX_FILE.new $GIT_INDEX_FILE' HEAD

git filter-branch --index-filter 'git rm -r --cached big_dira big_dirb' should be working nowadays.

Mike
Previous: Alex BenneeNext: Alex Bennee
Message 8 of 14 in “Truncating and cleaning a imported git repositary to make it more usable”
  1. Alex BenneeMar 28, 2008
  2. Avery PennarunMar 28, 2008
  3. Alex BenneeMar 28, 2008
  4. Alex BenneeMar 28, 2008
  5. Alex BenneeMar 28, 2008
  6. Johannes SixtMar 28, 2008
  7. Documentation: Another example for git-filter-branchAlex Bennee, Mar 28, 2008
  8. Mike HommeyMar 28, 2008
  9. Alex BenneeMar 29, 2008
  10. Jakub NarebskiMar 29, 2008
  11. Johannes SixtMar 31, 2008
  12. Jeff KingMar 28, 2008
  13. Jeff KingMar 28, 2008
  14. Michael HaggertyMar 29, 2008

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.