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

Consider adding pruning of refs to git maintenance

From
Shubham Kanodia <shubham.kanodia10@gmail.com>
Date
Dec 16, 2024, 12:33 UTC
Message-ID
<CAG=Um+0v=BmmYjvBAXs4r4My6zYvpJvcE+0U6SAnxKUcd1-A4w@mail.gmail.com>

Remote-tracking refs accumulate quickly in large repositories as users merge and delete their branches. While these branches are cleaned up on the remote, local repositories may retain stale references to deleted branches unless explicitly pruned. The number of local refs can have an impact on git performance of several commands.

Git currently provides two ways for orphan local refs to be cleaned up —
1. Automated: `fetch.prune` and `fetch.pruneTags` configurations with
`git fetch/pull`
2. Manual: `git remote prune`
However, both approaches have issues:
- Full `git fetch/pull` operations are expensive on large
repositories, pulling thousands of irrelevant refs
- Manual `git remote prune` requires user intervention

Proposal: Add remote pruning to the daily `git-maintenance` task. This would clean stale refs automatically without requiring full fetches or manual intervention.

This is especially useful for users who historically pulled all refs/tags but now use targeted fetches. Moreover, it decouples the cleanup action (pruning) from the action to fetch more refs.

Happy to submit on a patch for the same unless there's something obvious that I've missed here.

Next: Patrick Steinhardt
Message 1 of 11 in “Consider adding pruning of refs to git maintenance”
  1. Shubham KanodiaDec 16, 2024
  2. Patrick SteinhardtDec 17, 2024
  3. Junio C HamanoDec 17, 2024
  4. Shubham KanodiaDec 17, 2024
  5. Shubham KanodiaDec 17, 2024
  6. Junio C HamanoDec 17, 2024
  7. Shubham KanodiaDec 18, 2024
  8. Junio C HamanoDec 18, 2024
  9. Shubham KanodiaDec 22, 2024
  10. Junio C HamanoDec 23, 2024
  11. Shubham KanodiaDec 23, 2024

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.