Re: master^ is not a local branch -- huh?!?

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

 



On Fri, Jan 29, 2010 at 11:39 PM, Nicolas Pitre <nico@xxxxxxxxxxx> wrote:
> First, I'm afraid that "Checking out commit 'foobar'" might be confusing
> as this may happen through either a remote branch, a tag, or any random
> commit.  It seems to me that "Checking out 'v2.5'" is less confusing
> than "Checking out commit 'v2.5'".  But that's a minor detail and
> probably a personal preference.

I'm fine with "Checking out 'v2.5'".

> I consider that starting the explanation paragraph with " any commits
> you make will be lost" is even more unfriendly, and misleading.  That is
> sure to scare people needlessly.

See wording below.

> I think your wording is just too far on the negative side, and makes Git
> look like an even more difficult tool than it actually is.  And you help
> no one by stating things that are not exactly true even if the truth
> implies that you need to know what you're doing.

What is not true?  Sure, they're not really "lost", but there's no
concise yet fully correct way to say the full truth.  Would you prefer
"discarded"?

> The _whole_ and only
> point of a detached HEAD is actually to be able to make commits even
> without having to create a new branch first.

Wrong.  I have never (purposefully) made a commit on a detached HEAD,
yet I use a detached HEAD all the time.  Why?  Because I checkout a
particular commit to look at code at a given location.  For example, I
recently ran "git checkout v1.6.6.1".  I did not intend to make any
commits on this; I just wanted to look at and compile code at a
particular version.  I think most users do the same thing.  The reason
for the warning is that folks make a mistake of trying to commit
without first switching back to (or creating) a branch.


Anyway, how about the following message, which is more in line with
Junio's last version?

-- >8 -- not a patch -- >8 --
Checking out 'master^0'.

This is not a local branch head, so you are in a 'detached HEAD' state.
If you only plan to look at files, this is fine.  However, any commits you
make will not update a branch, and may be discarded when you check out
another branch or commit.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

 git checkout -b <new_branch_name>

HEAD is now at a9d7c95... Merge branch 'maint'
-- 8< -- not a patch -- 8< --
--
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]