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

Fwd: Bug#793884: git: allows nonsensical command 'git checkout -b HEAD'

From
Duy Nguyen <pclouds@gmail.com>
Date
Jul 28, 2015, 14:33 UTC
Message-ID
<CACsJy8Atx7h8LHQ26rTx2jPUxL-+MSLva8njdoUs5+Aq-Eoj4Q@mail.gmail.com>
In-Reply-To
<20150728141858.22342.16605.reportbug@zam581.zam.kfa-juelich.de>

This seems like a good thing to fix (i.e. make sure XX is not ambiguous before creating it with "git checkout -b XX")

---------- Forwarded message ----------
From: Andreas Beckmann <anbe@debian.org>
Date: Tue, Jul 28, 2015 at 9:18 PM
Subject: Bug#793884: git: allows nonsensical command 'git checkout -b HEAD'
To: Debian Bug Tracking System <submit@bugs.debian.org>
Package: git
Version: 1:2.1.4-2.1
Severity: normal
Tags: upstream

$ git branch HEAD fatal: it does not make sense to create 'HEAD' manually # OK, special casing prevents this $ git checkout -b HEAD Switched to a new branch 'HEAD' # but not this :-P $ git checkout master Switched to branch 'master' $ git checkout HEAD warning: refname 'HEAD' is ambiguous. Switched to branch 'HEAD' # oops ;-) $ git checkout master Switched to branch 'master' $ git branch -d HEAD Deleted branch HEAD (was 6e54945). # OK, we can easily cleanup this mess again

The same works in 1:2.4.6-1 in sid.

If there is some special casing for HEAD in git branch, the same should probably be done for git checkout -b, too.

Andreas
-- 
Duy
Next: Junio C Hamano
Message 1 of 2 in “Fwd: Bug#793884: git: allows nonsensical command 'git checkout -b HEAD'”
  1. Duy NguyenJul 28, 2015
  2. Junio C HamanoJul 28, 2015

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.