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

Archiving off old branches

From
TCTim Chase <git@tim.thechases.com>
Date
Apr 23, 2014, 17:08 UTC
Message-ID
<20140423120850.3f6fb535@bigbox.christie.dr>

I've got a branch for each bug/issue and it was getting a bit unwieldy. A little searching suggested this

  # archive off the BUG-123 branch
  git update-ref refs/closed/BUG-123 BUG-123
  git branch -D BUG-123

which seems to do exactly what I want -- branches are archived off so they still have refs, but they don't appear in the output of "git branch".

Reading up on "git help update-ref", it states that it updates the name "safely". As best I can tell, the above process does something like

  cd .git/refs
  mkdir -p closed
  mv heads/BUG-123 closed

Is there something unsafe about this? The advantage to the latter would be that I could do a bunch of them easily:

  mv heads/BUG-{123,234,345,456,567} closed

but I want to make sure I'm not screwing something up unsafely. Is there some key element to "update-ref"'s safety that I'm missing?

-tkc
Next: Junio C Hamano
Message 1 of 5 in “Archiving off old branches”
  1. Tim ChaseApr 23, 2014
  2. Junio C HamanoApr 23, 2014
  3. Jonathan NiederApr 23, 2014
  4. Tim ChaseApr 23, 2014
  5. Junio C HamanoApr 23, 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.