Archiving off old branches

3 messages, 2 authors, 2016-06-15 · open the first message on its own page

Archiving off old branches

From: Tim Chase <hidden>
Date: 2016-06-15 23:00:47

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

Re: Archiving off old branches

From: Jonathan Nieder <hidden>
Date: 2016-06-15 23:00:48

Hi,

Tim Chase wrote:
  cd .git/refs
  mkdir -p closed
  mv heads/BUG-123 closed
That breaks with packed refs (see git-pack-refs(1)), which are a normal
thing to encounter after garbage collection.

Hope that helps,
Jonathan

Re: Archiving off old branches

From: Tim Chase <hidden>
Date: 2016-06-15 23:00:48

On 2014-04-23 10:58, Jonathan Nieder wrote:
Tim Chase wrote:
quoted
  cd .git/refs
  mkdir -p closed
  mv heads/BUG-123 closed
That breaks with packed refs (see git-pack-refs(1)), which are a
normal thing to encounter after garbage collection.

Hope that helps,
Very much so.  Alrighty...based on that alone, I'll stick to my
archive script that calls update-ref and then deletes the branch.

Thanks,

-tkc
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help