Is there a way in git to have a 'description' for branches? While I try to use descriptive names, working for a while on a single branch sometimes dampens my memory of why I made some of the other topic branches. I try to use descriptive names for the branches but I think a 'description' (short note about the purpose of the branch) would be nice.
I am pretty sure that feature is not currently supported. I think your best bet is to create a description text file, a README basically, in the branch that has the information that you want.
The README
suggested by Chris J can work, provided it is setup with a custom merge driver defined in a .gitattribute
.
That way, the local version of the README
is always preserved during merges.
The "description" for branches is also know as a "comment" associated with that meta data, and it is not supported.
At least, with a README
file, you can, for any branch, do a:
$ git show myBranch:README
If your REAMDE is at the root directory of your REPO, it will work from any path, since the path used by git show
is an absolute one from the top directory of said repo.
The selected answer seems like overkill to me. I'd be inclined to maintain a per branch description file that is a normal source controlled file, say master.txt
, dev.txt
, etc. and if there is an unwieldy number or branches I'd create a hierarchy to better organize it.
You can attach comments to tags:
git tag -m 'this was a very good commit' tag1
By convention, you could have tags related to your branch names or you could use tag -f to keep a commented tag at the head of your topic branches.
I had a similar problem. I use that file to document branches and why they exist (among other things).
Since branches are mostly illusional in git (just a local handy name for a commit that you might want to use as a parent someday), why bother? Sounds like you need some other meta information somewhere.