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

Re: removing content from git history

From
Nicolas Pitre <nico@cam.org>
Date
Feb 21, 2007, 18:52 UTC
Message-ID
<alpine.LRH.0.82.0702211345350.31945@xanadu.home>
In-Reply-To
<20070221183028.GA9088@ginosko.local>
On Wed, 21 Feb 2007, Michael Hendricks wrote:
> What's a decent way to make a branch into a new repository?  My first
> inclination is to "cp -a" the existing repository, checkout the branch,
> delete all other branches and repack.  That seems to have worked in my
> quick test, but is there a better way?

Like Shawn said the better way is simply to fetch that branch into a new repo.

If you do a cp -a and delete unwanted branches it'll work as well of course, but repacking won't get rid of all the data from the believed to be deleted branches since some reflog, the HEAD reflog in particular, will most probably have references to commits from the removed branches. Therefore the pack will still contain that data, at least untill the reflog entries expire and get pruned.

Of course if you want to publish just the wanted branch and perform a push to a public place then only those objects for that branch will be sent like for the fetch case.

Nicolas
Previous: Linus TorvaldsNext: Junio C Hamano
Message 21 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.