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

Re: Purging old history

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Mar 31, 2012, 04:43 UTC
Message-ID
<CALkWK0=mcQR3CBMpa5P1f+JwqNMqUs3D4=tVPx4c_4R+TXCKbw@mail.gmail.com>
In-Reply-To
<17650-1333167969-40275@sneakemail.com>
Hi John,
John M. Dlugosz wrote:
> Is there a simple way to delete old commits, say beyond a certain age,
> before putting it on the server?  The ancient stuff is not relevant and
> there are a lot of binaries.  Some users may have trouble with an extensive
> download when syncing the first time.

Yes, although your terminology is wrong: it's not about "deleting" commits; simply create a fresh root commit and rebase your work on top of it. As an example, let's say you want to squash history from the 67afe1 (the old root) to 7ef42b on the master branch:

$ git checkout -b newroot 7ef42b $ git reset 67afe1 $ git add . $ git commit --amend $ git checkout master $ git rebase --onto newroot 7ef42b

    Ram
Previous: John M. DlugoszNext: Jakub Narebski
Message 2 of 4 in “Purging old history”
  1. John M. DlugoszMar 31, 2012
  2. Ramkumar RamachandraMar 31, 2012
  3. Jakub NarebskiMar 31, 2012
  4. Phil HordMar 31, 2012

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.