Re: [PATCH] Detached HEAD (experimental)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Carl Worth
Date: Tuesday, January 2, 2007 - 2:56 pm

On Mon, 01 Jan 2007 23:45:08 -0800, Junio C Hamano wrote:

Being able to perform "checkout" with a tag like this, (and no
specific branch), is something I've been wanting git to acquire for
some time. So, thanks for coding this up!


This part I don't understand. I don't see why it's useful to introduce
new danger to "git checkout" in that after this change it could cause
commits to become dangling. Currently, "git checkout" is entirely
safe, as are most git commands. The few commands that create dangling
commits require fairly explicit actions from the user, (such as
"--hard" for git-reset or -D instead of -d for git-branch).

So I'd vote against this aspect. I'd rather see commits to a detached
head be disallowed with a message instructing the user to do "git
checkout -b new-branch" in order to do the commit.

And with that new safer behavior, I think it would be a good idea to
just drop the "-d" option from git-checkout.

I want this new behavior not for people who know what they are doing,
but people who are using git only incidentally, (say they just want to
acquire and build the latest version of some software). So I'd like
the sequence to work along the lines of your earlier post, (as quoted
by another reply). Specifically, I wouldn't want to see any warning
about a "missing branch" until a commit was attempted.

This would allow a sequence like this to proceed without git ever
telling the user they were doing something "wrong":

	$ git clone git://git.kernel.org/pub/scm/git/git.git
	$ cd git
	$ git checkout v1.4.3
	$ make

With the recent improvements to the git-checkout error message
(thanks!) this sequence is at least successful eventually after the
user reads and responds to the following:

	git checkout: provided reference cannot be checked out directly

	  You need -b to associate a new branch with the wanted
	  checkout. Example:
	  git checkout -b <new_branch_name> v1.4.3

But the user is required to invent a name and deal with its existence
later. For example, after some time, imagine the same user wanting
to update to the latest and build again:

	git pull origin
	git checkout v1.5.0

Now the user has to invent _another_ unique branch name, (or learn
"git branch -d" or "git reset --hard" or ...), while this branch
concept and these other commands aren't actually helping the user with
the task at hand, (just tracking the code and building the most recent
version).

Similarly, I think this use case of "just tracking" should support
branches disappearing from the remote repository without the user
having to edit any config file. If there are entries that are
automatically added by git-clone that should be removed later, that
should happen automatically. A recent thread suggested adding an error
message instructing the user to delete the entries. That's again
unkind to a user who doesn't really want to learn git, but just wants
to get at the most recent version of some code that happens to be
available through git.

That disappearing branches cause problems requiring manual cleanup of
configuration files is one of the reasons that we are not using any
feature branches in the "central" cairo repository, for example, (we
do have branches for release maintenance). I'd really like to be able
to put some feature branches there for shared work, (rather than
forcing that work out to separate personal repositories as we do
know).

Maybe the configuration file entries added by git-clone need to be
marked in some way to distinguish them from manually added entries, so
that we would feel more comfortable automatically removing them when a
remote branch has disappeared.

-Carl
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Detached HEAD (experimental), Junio C Hamano, (Tue Jan 2, 12:45 am)
Re: [PATCH] Detached HEAD (experimental), Edgar Toernig, (Tue Jan 2, 12:59 pm)
Re: [PATCH] Detached HEAD (experimental), Carl Worth, (Tue Jan 2, 2:56 pm)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Tue Jan 2, 3:44 pm)
[PATCH] git-branch: show detached HEAD, Lars Hjemli, (Tue Jan 2, 4:22 pm)
Re: [PATCH] Detached HEAD (experimental), Carl Worth, (Tue Jan 2, 4:34 pm)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Tue Jan 2, 7:45 pm)
Re: [PATCH] git-branch: show detached HEAD, Shawn O. Pearce, (Tue Jan 2, 10:18 pm)
Re: [PATCH] git-branch: show detached HEAD, Junio C Hamano, (Wed Jan 3, 12:05 am)
Re: [PATCH] git-branch: show detached HEAD, Lars Hjemli, (Wed Jan 3, 12:37 am)
Re: [PATCH] Detached HEAD (experimental), Jeff King, (Wed Jan 3, 3:46 am)
Re: [PATCH] Detached HEAD (experimental), Jeff King, (Wed Jan 3, 4:59 am)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Mon Jan 8, 4:19 am)
Re: [PATCH] Detached HEAD (experimental), Jeff King, (Mon Jan 8, 6:17 am)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Mon Jan 8, 5:19 pm)
Re: [PATCH] Detached HEAD (experimental), Carl Worth, (Mon Jan 8, 5:43 pm)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Mon Jan 8, 6:05 pm)
Re: [PATCH] Detached HEAD (experimental), Carl Worth, (Mon Jan 8, 6:15 pm)
Re: [PATCH] Detached HEAD (experimental), Shawn O. Pearce, (Mon Jan 8, 8:26 pm)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Tue Jan 9, 12:07 am)
Re: [PATCH] Detached HEAD (experimental), Luben Tuikov, (Tue Jan 9, 1:12 am)
Re: [PATCH] Detached HEAD (experimental), Jeff King, (Tue Jan 9, 7:21 am)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Tue Jan 9, 2:20 pm)
Re: [PATCH] Detached HEAD (experimental), J. Bruce Fields, (Tue Jan 9, 2:31 pm)
Re: [PATCH] Detached HEAD (experimental), Carl Worth, (Tue Jan 9, 2:43 pm)
Re: [PATCH] Detached HEAD (experimental), J. Bruce Fields, (Tue Jan 9, 2:53 pm)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Tue Jan 9, 3:37 pm)
Re: [PATCH] Detached HEAD (experimental), Shawn O. Pearce, (Tue Jan 9, 4:39 pm)
Re: [PATCH] Detached HEAD (experimental), Shawn O. Pearce, (Tue Jan 9, 4:44 pm)
Re: [PATCH] Detached HEAD (experimental), Linus Torvalds, (Tue Jan 9, 4:46 pm)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Tue Jan 9, 5:10 pm)
Re: [PATCH] Detached HEAD (experimental), Shawn O. Pearce, (Tue Jan 9, 5:18 pm)
Re: [PATCH] Detached HEAD (experimental), Carl Worth, (Tue Jan 9, 5:51 pm)
Re: [PATCH] Detached HEAD (experimental), Linus Torvalds, (Tue Jan 9, 5:54 pm)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Wed Jan 10, 1:02 am)
Re: [PATCH] Detached HEAD (experimental), Andy Parkins, (Wed Jan 10, 2:04 am)
Re: [PATCH] Detached HEAD (experimental), Shawn O. Pearce, (Wed Jan 10, 2:05 am)
Re: [PATCH] Detached HEAD (experimental), Andreas Ericsson, (Wed Jan 10, 2:08 am)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Wed Jan 10, 2:33 am)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Wed Jan 10, 2:40 am)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Wed Jan 10, 2:46 am)
Re: [PATCH] Detached HEAD (experimental), Andy Parkins, (Wed Jan 10, 3:10 am)
Re: [PATCH] Detached HEAD (experimental), Shawn O. Pearce, (Wed Jan 10, 3:25 am)
Re: [PATCH] Detached HEAD (experimental), Jeff King, (Wed Jan 10, 7:04 am)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Wed Jan 10, 9:18 am)
Re: [PATCH] Detached HEAD (experimental), Daniel Barkalow, (Wed Jan 10, 9:30 am)
Re: [PATCH] Detached HEAD (experimental), Junio C Hamano, (Wed Jan 10, 5:34 pm)
Re: [PATCH] Detached HEAD (experimental), J. Bruce Fields, (Wed Jan 10, 9:31 pm)
Re: [PATCH] Detached HEAD (experimental), Andreas Ericsson, (Thu Jan 11, 2:45 am)