I confirm there is no way for now to display the description of the branch with git branch
(as opposed to git config
, see last part of this answer below).
This thread includes
The coming v1.7.9 will introduce branch description, mainly used in
integration process. I think we could make it useful for users who
don't extensively use request-pull/format-patch. Showing a short
summary along with branch name in "git branch
" would be nice.
I agree that it would be nice to give users access to the information even
if the branch ends up being merged to the master branch by you and never
leaves your repository by itself.
You however are misguided to say "Showing a short summary along...".
The branch description support is to give users a place to record detailed explanation about a branch, similar in size to what you would normally place in a log message of a commit or a cover letter of a series.
There wasn't any convenient place to do so for a branch that is (1) inherently a moving target while it is being developed and (2) is not a good match for tags and notes.
There already is a good place for a brief summary and it is called "branch name". Name your branches just like you name your functions.
The suggested patch "git branch --verbose-format
" is not yet completed.
So the script mentioned by poke, remains (with a git alias
) one possible solution:
#!/bin/perl
$output= `git branch`;
foreach my $line (split(/^/, $output)) {
my ($is_current, $name) = split(/\s+/, $line);
my $description = `git config branch.$name.description`;
$description =~ s/\s+$//;
printf("%1s %-22s %s\n", $is_current, $name, $description);
}
Philip Oakley suggests in the comments:
You can display the branch description using a git config
command.
To show all branch descriptions, I have the alias
brshow = config --get-regexp 'branch.*.description'
, and for the current HEAD I have
brshow1 = !git config --get "branch.$(git rev-parse --abbrev-ref HEAD).description".