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

Re: Pruning objects from history?

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 31, 2007, 16:18 UTC
Message-ID
<Pine.LNX.4.64.0703310913350.6730@woody.linux-foundation.org>
In-Reply-To
<20070331131134.GC25539@thunk.org>
On Sat, 31 Mar 2007, Theodore Tso wrote:
> 
> It's painful to rewrite history, since you end up needing to rewrite
> every single commit after the point where you've tampered with time to
> fix up the parent commit ID.

Well, if you don't ever need to actually rewrite blob objects, and many of the trees end up being the same, history rewriting is actually pretty cheap. If it mostly just has to rewrite the commits and a few trees, you end up having (even for big projects) just a few hundred thousand easy objects to rewrite. It's going to take a minute or two at most.

"git-convert-objects" has most of the logic, so some trivial added code to "convert" tree objects by removing certain entries should just do it. But yeah, it would involve some real changes. cg-admin-rewritehist should be able to do it already, although I suspect it would be slower (but for a one-shot thing, nobody probably cares, and changing convert-objects is probably going to take more time than just running the rewritehist scripts).

> If you just want to do a one-way import, it's probably going to be
> much easier to modify whatever importer you use to not import the big
> files in the first place.

I'd actually like cg-admin-rewritehist to be merged into git. I think it's one of the few things that cogito does that native git doesn't do.

		Linus
Previous: Theodore Tso
Message 4 of 4 in “Pruning objects from history?”
  1. Steven GrimmMar 31, 2007
  2. Shawn O. PearceMar 31, 2007
  3. Theodore TsoMar 31, 2007
  4. Linus TorvaldsMar 31, 2007

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.