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

Re: removing content from git history

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Feb 21, 2007, 17:14 UTC
Message-ID
<Pine.LNX.4.64.0702210904350.4043@woody.linux-foundation.org>
In-Reply-To
<20070221164527.GA8513@ginosko.local>
On Wed, 21 Feb 2007, Michael Hendricks wrote:
Show 5 quoted lines
>
> I assume that this question has already been addressed on the mailing
> list, but I wasn't able to find anything about it in the archives.
> 
> Is it possible to remove content entirely from git's history?
It's been discussed.
There are two options for doing it:
 - rewriting history. There are a few tools for this already, and for 
   specific needs it would be fairly easy to resurrect git-convert-objects 
   to do it for any kind of object.
   See "cg-admin-rewritehist" from cogito for an example of a tool that 
   would do what you need done. In fact, it has this exact thing as the 
   first example.
   (Btw, I think cg-admin-rewritehist is one of the few things that cogito 
   had that was really a good idea. Not that people probably _used_ it 
   much, but it's somethign that makes sense in the plumbing)
 - explicit support for "missing objects". We don't do it right now, but 
   we could add it. It was discussed for things like limited history etc 
   (the "shallow clone" kind of thing, before people actually added 
   shallow clones), and it would support the notion of "we export all our 
   history, but for internal reasons we cannot make certain objects 
   available" kinds of workflows.

So right now, rewriting history is an option that you can do. It will effectively create a totally new branch (which you can then make into a new repository) which has nothing in common with the old branch from the point where it was modified. So you can never really merge the two ever again, and you need to make sure that everybody who had the old repo contents will destroy it.

But at least in theory, it wouldn't be impossible to extend on the ".git/grafts" kind of setup to say "this object has been consciously deleted", and that could in some circumstances be a better model. The biggest headache there would be the need to extend the native git protocol with a way to add such objects.

			Linus
Previous: Johannes SchindelinNext: Nicolas Pitre
Message 13 of 25 in “removing content from git history”
  1. Michael HendricksFeb 21, 2007
  2. Shawn O. PearceFeb 21, 2007
  3. J. Bruce FieldsFeb 21, 2007
  4. Linus TorvaldsFeb 21, 2007
  5. Linus TorvaldsFeb 21, 2007
  6. Shawn O. PearceFeb 21, 2007
  7. Linus TorvaldsFeb 21, 2007
  8. Shawn O. PearceFeb 21, 2007
  9. Bill LearOct 9, 2007
  10. J. Bruce FieldsOct 9, 2007
  11. Bill LearOct 9, 2007
  12. Johannes SchindelinOct 10, 2007
  13. Linus TorvaldsFeb 21, 2007
  14. Nicolas PitreFeb 21, 2007
  15. Linus TorvaldsFeb 21, 2007
  16. Nicolas PitreFeb 21, 2007
  17. Michael HendricksFeb 21, 2007
  18. Shawn O. PearceFeb 21, 2007
  19. Linus TorvaldsFeb 21, 2007
  20. Linus TorvaldsFeb 21, 2007
  21. Nicolas PitreFeb 21, 2007
  22. Junio C HamanoFeb 21, 2007
  23. Nicolas PitreFeb 21, 2007
  24. Junio C HamanoFeb 21, 2007
  25. Nicolas PitreFeb 21, 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.