Git branches with descriptions

How to set and see git branch descriptions.

Having single word git branch names is incredibly frustrating. I try to use same branch names as issue ids, which makes it even less descriptive. Finally I found that the current stable git version supports editing branch descriptions, but not displaying them (conveniently).

To describe a branch, use git branch --edit-description, edit the opened file, save and exit. If one editor does not work, try another. For me Sublime does not work in this case, but vi does.

alternative: for single line descriptions use git config branch.<branch name>.description "describe branch".

To show description of a branch, use command git config branch.<branch name>.description. Pretty obvious, right?

Unfortunately, git branch still only shows the list of branch names, without descriptions. I wrote a small Bash script branches.sh to grab all branch names, then query each description and finally display same output as git branch but with extra column

$ ./branches.sh
* master        this is master branch
one             this is simple branch for testing

One can also just put the functionality directly into .bash_profile or .alias file to has branches command available everywhere, see code