Can I add a descriptive label to a Git branch?

Possible duplicate:
Industry descriptions in git

Can I add a description to the Git branch? I would like my branch names to be fairly short, but sometimes it would be useful to list them with the attached short description.

+8
git
source share
2 answers

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 with this command:

  git notes show your_branch 

You can store your notes as a file and use them instead by switching the -m option to the -f option and, of course, passing the file name rather than a string.

  git notes add your_branch -f mynotes.txt 
+2
source share

The place to add descriptions and the name of your branch should be in the merge commit notes. This is due to the fact that the branches must be short-lived, and their branch tip cannot be guaranteed to last forever.

The time you really need (descriptive branch names) is when you should look at an old story that has merged on it, and after the branch of the branch (tip) is deleted, etc. And you need to know more that it was all (aka you should have written better messages about the commit, -)

Thus, the merge commit will display the names / details of the branches of the parent branches (especially No2, No3, .., since the name No. 1 will either be a "master" or will be displayed on a subsequent merge).

Remember that the name and description of a branch is a convenience, not a necessity. I am sure there are Linus T links with this effect (usually with some emphasis;)

You will already get some help with branch names .. how-to-avoid-merge-branch-name-of-branch-in-commit-messages

+1
source share