]> git.ipfire.org Git - thirdparty/git.git/commit
switch: only allow explicit detached HEAD
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 29 Mar 2019 10:39:11 +0000 (17:39 +0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 2 Apr 2019 04:57:00 +0000 (13:57 +0900)
commit7968bef06b750fe9c59c1e1d0573bffc5b3cd94f
tree3c85aabdf72839cf3b414fe260aaca5540561add
parente342c63a4e070bd1398b9aa86ac4ce917edbadc7
switch: only allow explicit detached HEAD

"git checkout <commit>" will checkout the commit in question and
detach HEAD from the current branch. It is naturally a right thing to
do once you get git references. But detached HEAD is a scary concept
to new users because we show a lot of warnings and stuff, and it could
be hard to get out of (until you know better).

To keep switch a bit more friendly to new users, we only allow
entering detached HEAD mode when --detach is given. "git
switch" must take a branch (unless you create a new branch,
then of course switch can take any commit-ish)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/checkout.c