I like the convenience of a script as we don't get the nice "delete branch" button in GitHub after we merge a PR (as we're on a mirror from Apache - i assume).
Daniel, what happens when we have two versions going though? like for 3.1.2-incubating and 3.2.0-incubating when we run the script on release of 1 it will blow out the branches for the other - it's not going to be "release" specific. I guess that's ok....... On Mon, Feb 8, 2016 at 2:30 PM, Daniel Kuppitz <m...@gremlin.guru> wrote: > Hi devs, > > after the TP 3.1.1 release was managed by Stephen, we had to clean up / > delete a lot of branches that were no longer needed. We used to delete > branches as soon as we were done with the work on it, but at some point > Apache disabled the functionality to delete branches and so we ended up > with a lot of dead branches. > > For the cleanup I've used a simple shell script that checks the status of > the respective Jira ticket and if it's closed, the branch is assumed to be > no longer needed and will be deleted. > > This is the script: > > for branch in $(git branch -r | grep -Po 'TINKERPOP[3]?-.*') > do > jira=`sed 's/TINKERPOP3/TINKERPOP/' <<< $branch | grep -Po > 'TINKERPOP-[0-9]*'` > status=`curl -s https://issues.apache.org/jira/browse/$jira | grep -A1 > status-val | grep -Po '(?<=>)[^<]*(?=)' | head -n1` > if [ "$status" == "Closed" ]; then > git push origin --delete $branch > fi > done > > > Do people like the idea of running this script as part of the release > process? In this case developers would no longer need to remember to delete > development branches; however naming conventions would become even more > important AND tickets should only be closed after the branch was merged. > > Cheers, > Daniel >