Git branch cleanup

David Osguthorpe david.osguthorpe at gmail.com
Fri Apr 11 20:26:06 EDT 2014


On Fri, Apr 11, 2014 at 04:11:26PM -0700, John Ralls wrote:
> 
> On Apr 11, 2014, at 4:02 PM, David Osguthorpe <david.osguthorpe at gmail.com> wrote:
> 
> > On Fri, Apr 11, 2014 at 03:10:22PM -0700, John Ralls wrote:
> >> I’d like to delete most of the old feature branches from the repository, but I don’t want to lose the history, so I’ve created a new branch called “archive” and merged in the feature branches in the right order. 
> >> 
> >> Having the “heads” of those branches merged into archive means that the branches themselves can be removed without having the commits that belong to them garbage collected, preserving history.
> >> 
> >> There are still a few abandoned branches that were never merged. I propose to leave them and the release branches in place, though there are two release branches, xacc-10-patch and xacc-12-patch, that I’d like to rename to 1.0 and 1.2 so that they’ll be consistent.
> >> 
> >> Any comments or complaints?
> >> 
> > 
> > An approach Ive used to clean up the git branch print out while retaining the old heads
> > is to move the refs into another refs directory out of the heads directory
> > (git branch only prints from ref/heads by default)
> > 
> > eg this first copies any refs with the string _cvs from refs/heads into refs/cvs
> > then deletes those same references from refs/heads
> > (I didnt think of this - found it after some googling)
> > 
> > git for-each-ref --format='%(refname:short)' refs/heads | grep  _cvs | xargs -n 1 -I {}  git update-ref refs/cvs/{} {}
> > 
> > git for-each-ref --format='%(refname:short)' refs/heads | grep  _cvs | xargs -n 1 -I {}  git branch -D {}
> 
> Neat. We could do that with the 1.X branches as well and have an easily navigable list. Know of any reason not to do it with old tags as well?
> 

I dont see why not - but have not done it - refs/tags is essentially the same semantics as refs/heads

David


More information about the gnucash-devel mailing list