Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Duy Nguyen <hidden>
Date: 2016-06-15 23:05:54

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 <redacted>
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 <redacted>


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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help