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

Re: [PATCH] git-branch: display sha1 on branch deletion

From
Jeff King <peff@peff.net>
Date
Dec 12, 2008, 19:43 UTC
Message-ID
<20081212194349.GA5486@sigill.intra.peff.net>
In-Reply-To
<uTIFnEi0iyLKcAungf7u1Gu2xl50j9i-AMiZaQp-QTs1q-ppgyHZoelGLgvK7BFKpYE03BLRHJ4@cipher.nrlssc.navy.mil>
On Fri, Dec 12, 2008 at 01:29:01PM -0600, Brandon Casey wrote:
> Make it easier to recover from a mistaken branch deletion by displaying the
> sha1 of the branch's tip commit.
I think this is reasonable behavior, but I have two comments:
> -			printf("Deleted %sbranch %s.\n", remote, argv[i]);
> +			printf("Deleted %sbranch %s (%s).\n", remote, argv[i],
> +                                sha1_to_hex(sha1));
1. Any reason not to use find_unique_abbrev(sha1, DEFAULT_ABBREV) here?
   The full 40-character sha1 kind of dominates the line, especially if
   you have short branch name. And this is not really for long-term
   usage, but rather "oops, I didn't mean to have just deleted that".
2. I wonder if it is confusing to new users to simply say "Delete branch
   $branch ($sha1)". We haven't deleted $sha1, just the branch pointer.
   $sha1 is probably still in the HEAD reflog, if not in another branch.
   Maybe something like "(was $sha1)" would be appropriate.

I don't know if '2' is a big deal. I haven't been a new user for a long time, so I didn't personally find it confusing (especially with '1' so that you actually notice the branch name rather than the gigantic sha1).

-Peff
Previous: Brandon CaseyNext: Brandon Casey
Message 2 of 6 in “git-branch: display sha1 on branch deletion”
  1. git-branch: display sha1 on branch deletionBrandon Casey, Dec 12, 2008
  2. Jeff KingDec 12, 2008
  3. Brandon CaseyDec 12, 2008
  4. git-branch: display sha1 on branch deletionBrandon Casey, Dec 12, 2008
  5. Jeff KingDec 13, 2008
  6. Brandon CaseyDec 15, 2008

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.