Re: [PATCH] tone down the detached head warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> writes:

> I think part of the "scariness" of the message is that git-checkout does
> not _usually_ produce output. I wonder if, when switching HEAD, it
> usually printed "Now on branch <foo>", and for detached printed some
> special variant, it would seem more natural.

That sounds sensible.  Another thing I found slightly annoying
about branch switching in git-checkout is that we list the paths
with local changes only when the tip of the old branch and the
new branch are different.  Very often I start hacking while on
'master' and later find the change forms a concrete "theme", and
then say "git checkout -b that-theme" to switch a branch; in
such a case I do want the list of locally modified paths.

For example:

	: gitster project/master; edit foo.c
        : gitster project/master; git checkout -b theme
	M	foo.c
	Switched to a new branch "theme"
	: gitster project/theme; edit bar.c
        : gitster project/theme; git checkout master
	M	bar.c
        M	foo.c
        Switched to branch "master"
	: gitster project/master; git checkout master^
	M	bar.c
        M	foo.c
	Detached your HEAD -- you are not on any branch.
        If you want to create a new branch from this checkout, you may do so
        (now or later) by using -b with the checkout command again. Example:
          git checkout -b <new_branch_name>
	: gitster project; 

would feel very natural and much less scary.

Note.  I run with PS1=': \h \W$(__git_ps1 "/%s"); '.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]