git/list[1] front-page[2] threads[3] people[4] search[5] about
wed 2026-10-07 17:21 UTC

[PATCH] Prevent force updating of the current branch

From
Conrad Irwin <conrad.irwin@gmail.com>
Date
Aug 20, 2011, 21:49 UTC
Message-ID
<1313876989-16328-1-git-send-email-conrad.irwin@gmail.com>

I noticed when trying to improve the user-experience of creating ambiguous branches [1] that there are insufficient checks to safeguard git-branch -M and git-checkout -B from over-writing the current branch.

Conrad
[1] http://thread.gmane.org/gmane.comp.version-control.git/179503
---
 branch.c                   |   34 ++++++++++++++++++++++++----------
 branch.h                   |    8 ++++++++
 builtin/branch.c           |    6 +-----
 builtin/checkout.c         |   12 +++---------
 t/t2018-checkout-branch.sh |   17 +++++++++++++++++
 t/t3200-branch.sh          |   12 ++++++++++++
 6 files changed, 65 insertions(+), 24 deletions(-)
Next: Conrad Irwin
Message 1 of 5 in “Prevent force updating of the current branch”
  1. Prevent force updating of the current branchConrad Irwin, Aug 20, 2011
  2. 1/2 Prevent force-updating of the current branchConrad Irwin, Aug 20, 2011
  3. 2/2 Show interpreted branch name in error messagesConrad Irwin, Aug 20, 2011
  4. Junio C HamanoAug 23, 2011
  5. Conrad IrwinAug 23, 2011

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.