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

Thinning a repository

From
YDYuri D'Elia <wavexx@thregr.org>
Date
Nov 30, 2014, 12:18 UTC
Message-ID
<m5f1uq$na7$1@ger.gmane.org>
Hi everyone,

Is there a quick way to reproduce the effect of a shallow clone on a local repository that doesn't involve filter-branch and/or re-clone?

My motivation is to reduce the local size of repositories I'm only following, by trimming the history without prejudice to a [N] set of last commits. It feels stupid that the quickest way I'm aware of right now to achieve this is to "git clone --depth N ..." again. filter-branch is ridiculously slow, as it iterates through history.

I've tried using graft points, but the combination of:

echo [sha] > .git/info/grafts git reflog expire --expire=0 --all git repack -Ad

doesn't really save any space and/or reduce the object count as I would expect. It means there's probably still reachable?

I'd really love to have a 'git thin [depth]' subcommand to perform the above however. I don't really want to have to iterate through refs just to check if they are still reachable within [n] commits just to delete them.

Thanks for any pointer.
Next: Fredrik Gustafsson
Message 1 of 3 in “Thinning a repository”
  1. Yuri D'EliaNov 30, 2014
  2. Fredrik GustafssonNov 30, 2014
  3. Yuri D'EliaNov 30, 2014

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.