git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git branch descriptions

From
GBGeert Bosch <bosch@adacore.com>
Date
May 11, 2010, 01:16 UTC
Message-ID
<F658FEF6-8957-4815-8917-8545E166F6CC@adacore.com>
In-Reply-To
<20100510232612.GA6890@progeny.tock>
On May 10, 2010, at 19:26, Jonathan Nieder wrote:
> I think the closest thing we have now is ‘git branch -v’, which tells
> the subject of the commit at the tip of the branch.  ‘git notes’
> annotates commits rather than branches, so it occupies a different
> niche.

Indeed, I've not started to use the -v flag a lot more and wish it were default. However, when I started to think about attaching descriptions or any other information to branches, I started to realize what we'd lose with that.

Show 10 quoted lines
> 
> Your request is a reasonable one, and it has come up a few times in
> different forms over the years:
> 
> . per-branch descriptions in .git/description[1]
> . per-branch descriptions in .git/config[2][3]
> . README branch whose files describe the branches[4]
> 
> Number [2] is my preferred choice (and comes with code!), for what
> it’s worth.

The question is what you'd do with these when moving branches around. You could move the descriptions with the branches, though that would be a bit ugly implementation-wise: I don't quite like the idea of programs rewriting configuration files as part of regular operation.

Besides that, I find my self often use a workflow like:

% git checkout -b newtopic % (hack, commit, hack, commit, ...) % git log % (oops, better fix up those revision histories) % git checkout -b newtopic-fixup newtopic~2 % git cherry-pick newtopic~1 ; git commit --amend ; rinse ; repeat % (ok, finished, pretend the old stuff never happened) % git branch -M newtopic

If branches were more than just a way of naming a place to put commits, it would be getting much more heaving to do this kind of thing.

The other approach, of leaving them in place wouldn't be much more appealing either.

It seems if we'd do branch descriptions at all, their main use would be fore remote repositories. When you publish a branch, you'd typically not rewrite it on a whim, so attaching a description makes sense. Similarly, if you're tracking a remote repository, it would be helpful to get some information for the branch.

For local repositories, I have been amazed how useful the git branch -v is. And it comes for free, no need to enter any data!

Regards,
   -Geert
Previous: Jonathan NiederNext: Joel Reed
Message 4 of 10 in “git branch descriptions”
  1. Joel ReedMay 10, 2010
  2. Ramkumar RamachandraMay 10, 2010
  3. Jonathan NiederMay 10, 2010
  4. Geert BoschMay 11, 2010
  5. Joel ReedMay 11, 2010
  6. Michael J GruberMay 11, 2010
  7. Joel ReedMay 11, 2010
  8. Joel ReedMay 11, 2010
  9. Ævar Arnfjörð BjarmasonMay 11, 2010
  10. Joel ReedMay 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.