Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Branch descriptions in Git

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.

like image 376
Noufal Ibrahim Avatar asked Jan 21 '10 10:01

Noufal Ibrahim


People also ask

What is branch description?

1 : a part of a tree that grows out from the trunk or from a main division of the trunk. 2 : something extending from a main line or body like a branch a branch of a railroad. 3 : a division or subordinate part of something a branch of government The bank opened a new branch.

What are branches in git?

In Git, branches are a part of your everyday development process. Git branches are effectively a pointer to a snapshot of your changes. When you want to add a new feature or fix a bug—no matter how big or how small—you spawn a new branch to encapsulate your changes.


1 Answers

Git 1.7.9 supports this. From the 1.7.9 release notes:

  * "git branch --edit-description" can be used to add descriptive text    to explain what a topic branch is about. 

You can see that feature introduced back in September 2011, with commits 6f9a332, 739453a3, b7200e8:

struct branch_desc_cb {   const char *config_name;   const char *value; };  --edit-description:: 

Open an editor and edit the text to explain what the branch is for, to be used by various other commands (e.g. request-pull).

Note that it won't work for a detached HEAD branch.

That description is used by the script request-pull: see commit c016814783, but also git merge --log.

request-pull is a script used to summarizes the changes between two commits to the standard output, and includes the given URL in the generated summary.

[From @AchalDave] Unfortunately, you can't push descriptions since they're stored in your config, making it useless for the sake of documenting branches in a team.

like image 174
Greg Hewgill Avatar answered Sep 20 '22 19:09

Greg Hewgill