I would not archive branches. Put another way, branches archive themselves. What you want is to ensure the information relevant to archeologists can be found by reliable means. Reliable in that they aid daily development and doesn't add an extra step to the process of getting work done. That is, I don't believe people will remember to add a tag once they're done with a branch.
Here's two simple steps that will greatly help archeology and development.
- Link each task branch with an associated issue in the issue tracker using a simple naming convention.
- Always use
git merge --no-ff
to merge task branches; you want that merge commit and history bubble, even for just one commit.
That's it. Why? Because as a code archeologist, rarely do I start with wanting to know what work was done on a branch. Far more often it's why in all the screaming nine hells is the code written this way?! I need to change code, but it has some odd features, and I need to puzzle them out to avoid breaking something important.
The next step is git blame
to find the associated commits and then hope the log message is explanatory. If I need to dig deeper, I'll find out if the work was done in a branch and read the branch as a whole (along with its commentary in the issue tracker).
Let's say git blame
points at commit XYZ. I open up a Git history browser (gitk, GitX, git log --decorate --graph
, etc...), find commit XYZ and see...
AA - BB - CC - DD - EE - FF - GG - II ...
\ /
QQ - UU - XYZ - JJ - MM
There's my branch! I know QQ, UU, XYZ, JJ and MM are all part of the same branch and I should look at their log messages for details. I know GG will be a merge commit and have the name of the branch which hopefully is associated with an issue in the tracker.
If, for some reason, I want to find an old branch I can run git log
and search for the branch name in the merge commit. It is fast enough even on very large repositories.
That is what I mean when I say that branches archives themselves.
Tagging every branch adds unnecessary work to getting things done (a critical process which should be ruthlessly streamlined), gums up the tag list (not speaking of performance, but human readability) with hundreds of tags that are only very occasionally useful, and isn't even very useful for archeology.
git checkout [rev] file
– Jenette