14

Once a week we have integration meetings where we review code in branches not merged in to master. As a starting point we use this to list open branches

git branch -a --no-merged master

We name our branches after ticket numbers so it tough to see what we are really looking at. I get back

BUG_1231231
BUG_1412434
FEATURE_1231231
FEATURE_1232244

I know I can add and view descriptions by running
git branch --edit-description BUG_1231231
git config branch.BUG_1231231

The issue is these descriptions seemed to be stored in the config of my local repository. Can these descriptions be pushed to the remote?

personalt
  • 810
  • 3
  • 13
  • 26
  • Based on the answer below(can't be done) -> my plan B was to create txt file with the list branches and their descriptions and commit that . That seemed kinda lame though, is there a better way – personalt Jun 12 '12 at 14:33
  • But what about my initial answer: http://stackoverflow.com/questions/2108405/branch-descriptions-in-git/2108832#2108832 ? A `git show myBranch:README` might be "cleaner" than a text file for all branches (text file which could become out of sync with the actual branches, if some have been removed/added/renamed). Each `README` file is made within the branch itself. – VonC Jun 12 '12 at 16:13

2 Answers2

12

Considering the description is stored in the config file (here, the local one, within your Git repo), then, no, branch descriptions aren't pushed.

Config files are not pushed (ever). See "Is it possible to clone git config from remote location?"

Simple text files are, though, as my initial answer for branch description recommended at the time.

Branch descriptions are all about helping make an helpful message for publishing.
Not for copying that message over the other repos which won't have to publish the same information/commits.

Using branch.$name.description as the configuration key, give users a place to write about what the purpose of the branch is and things like that, so that various subsystems, e.g. "push -s", "request-pull", and "format-patch --cover-letter", can later be taught to use this information.


Update 2020 (8 years later):

philb mentions in the comments the issue gitgitgadget/git 438 about "Branch descriptions should be versionable".
philb adds:

If this is ever implemented, branch descriptions would be stored in refs and could then be pushed to a remote.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Tangentially related: see https://github.com/gitgitgadget/git/issues/438. If this is ever implemented, branch descriptions would be stored in refs and could then be pushed to a remote. – philb Nov 13 '20 at 17:01
  • 2
    @philb Good point, thank you. I have included your comment in the answer for more visibility. – VonC Nov 13 '20 at 17:05
1

This seems like a fairly recent git feature and may not be well supported yet. Take a look at the README feature, Branch descriptions in git

Community
  • 1
  • 1
gjcamann
  • 621
  • 4
  • 14