Thread (12 messages) flat view 12 messages, 6 authors, 2016-06-15

Re: user manual question

From: Daniel Barkalow <hidden>
Date: 2016-06-15 22:45:50

On Mon, 29 Dec 2008, Zorba wrote:
so a detached HEAD is just a HEAD that is not sitting on a tip ?
If you used CVS (extensively) back in the day, a detached HEAD is like 
what you get if you do something like "cvs checkout -D yesterday" (CVS 
called it "sticky tags"); you have a working directory that contains some 
revision that isn't your latest revision. If you make changes, they can't 
go into the history in the normal fashion, but you can build the project 
and figure out how it worked back then.

With git, of course, you can do things you couldn't do from that state 
with CVS. Because git supports forking history, you can make commits and 
create a new branch to be on. Because git can handle having visibility 
into other people's branches, you can get a detached HEAD by checking out 
somebody else's branch (something like origin/next, for example).

The normal "attached HEAD" state is that there's some branch that you 
update when you make a commit; the "detached HEAD" state means that, when 
you make a commit, no branch is affected.
i.e. if I do $ git reset --hard HEAD^

...pointing HEAD to the previous committ

this is a detached HEAD
Nope, it's "git checkout (something that isn't one of your branches)", 
just like CVS.

Git is like knitting. Commits are loops of yarn that hold other loops 
(their parents) in place; branches are knitting needles that keep new 
loops from falling out before other loops are holding them, and which hold 
different loops at different times as you work; HEAD is the tip of a 
needle that you use to make new loops. You usually use the tip of one of 
your regular needles to make new loops, and then the body of the needle 
holds the loop, but you could also use your fingers or something that will 
just make the loop temporarily; that's a detached HEAD, because it doesn't 
have the body of a needle behind it to hold loops when you use it for 
something else.

	-Daniel
*This .sig left intentionally blank*
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help