Is it possible to add a descriptive label to a Git branch? [duplicate]
Possible Duplicate:
Branch descripti开发者_如何学编程ons in git
Is there any way to add a description to a Git branch? I'd like to keep my branch names fairly short, but sometimes it would be useful to list them with some short description attached.
You can do this with git notes
:
git notes add your_branch -m "BRANCH_DESCRIPTION: A descriptive name for this branch"
Then you can read it back out using this command:
git notes show your_branch
You can store your notes as a file and use that instead, switching the -m
option for the -f
option and of course passing a filename rather than a string.
git notes add your_branch -f mynotes.txt
The place to add your branch descriptions & name should be in the merge commit
notes. This is because branches should be short lived, and their branch tip(s) can't be guaranteed to last forever.
The time you really need them (descriptive branch names) is when you have to review an old history that has merges on it and after that branch head(tip) has been deleted, etc. And you need more clues as to what it was all about (aka you should have written better commit messages ;-)
Thus the merge commit would list the branches names/details of the parent branches (especially No2, No3, .., as No 1's name will either be 'master', or will show up in a later merge).
Remember, the branch name and description is a convenience, not a necessity. I'm sure that there are posts by Linus T to that effect (usually with some emphasis ;-)
You already get some help on branch names .. how-to-avoid-merge-branch-name-of-branch-in-commit-messages
精彩评论