Write a script that deletes old merged Git branches
Our main Git repo already has 400+ branches, and it’s growing fast. Each branch results in a dedicated APT suite (that is, most of the time, empty). Keeping all those branches will also make the process of detecting active ones (form #6196 (closed)) slower.
We should detect, and delete, at least Git branches that were merged
into a released tag. We already have code in
auto/scripts/tails-custom-apt-sources
, in the main Tails Git
repository, to detect released tags. That could be reused somehow. An
initial implementation might copy’n’paste the logic or the code, but in
the end we should factor this out into a library or set of small utility
scripts.
Once we have a script that can do that, we can run it once to start with, and then maybe periodically (e.g. at post-release time).
Regarding the implementation language: if the one who undertakes this mission qualifies as an expert at writing robust, secure and elegant POSIX shell, and they want to do it this way, fine. Else, better go directly for (Modern) Perl or Python. Ruby lovers can certainly pick their language of choice too, but they’d better be careful about compatibility with future Ruby versions… we spend too much time already updating our existing Ruby code to 1.9.
Sources of inspiration:
- http://git-scm.com/book/en/Git-Branching-Branch-Management
- http://tech.taskrabbit.com/blog/2013/01/03/clean_git_branches/
- http://www.darkcoding.net/software/cleaning-up-old-git-branches/
- http://devblog.springest.com/a-script-to-remove-old-git-branches/
- https://stackoverflow.com/questions/3184555/cleaning-up-old-remote-git-branches
Feature Branch: feature/8617-delete-obsolete-Git-branches
Parent Task: #8617 (closed)
Related issues
- Related to #7036
- Blocks #6196 (closed)
Original created by @intrigeri on 7221 (Redmine)