Re: [Libreoffice] Git detached HEAD (no branch) was: newish to git: howto recover from bad merge?

2010-11-19 Thread Christian Lohmaier
Hi *,

On Fri, Nov 19, 2010 at 5:31 PM, Kohei Yoshida  wrote:
> On Fri, 2010-11-19 at 19:53 +0900, Takeshi Abe wrote:
>> $ git branch
>> * (no branch)
>>   master
>
> So, I'd like to expand on this mysterious "detached HEAD" thingie in
> git, [...]

I'll add to that:
Just never ever thing you're smart and git clone that directory first
to try things. When you do, you're screwed once you delete the
original copy, since the clone doesn't know anything about the
branches after that thing anymore, I had to spend too much time to
fixup with that.

detached heads in git are dangerous!!! Don't use them (always name it,
even if it is "stupidnametonotredoeverythingbecauseofdetachedheadmadness").
I learned the hard way…

Especially when you're used to mercurial and thing "what's so bad
about multiple heads, that's a no-brainer": GIT is very different in
this regard. You have been warned.

ciao
Christian
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] Git detached HEAD (no branch) was: newish to git: howto recover from bad merge?

2010-11-19 Thread Kohei Yoshida
On Fri, 2010-11-19 at 19:53 +0900, Takeshi Abe wrote:
> $ git branch
> * (no branch)
>   master 

So, I'd like to expand on this mysterious "detached HEAD" thingie in
git, since I just learned about this yesterday and it might help other
people understand what the heck is going on when you are "detached".

Basically, in git, the term "branches" roughly equals tips, or the last
commits of the branches.  They are sometimes referred to as "heads" (in
lowercase) though not as frequently as branches.  The term HEAD refers
to the last commit of the current branch.

Now, you are in a "detached HEAD" when you are not in the tip of a
branch.  For example, when you check out a particular commit via its
hash, or tag, your checkout is no longer the last commit of any branch,
hence you are detached.  And, when you start committing while you are in
that state, you are committing to this detached special branch called
(no branch).

To re-apply these changes from this detached branch to the tip of a
branch, you can use git rebase e.g.

git rebase master

to re-apply your changes over the top of the master branch.  In this
particular case, since your detached branch is entirely local, it's safe
to use git rebase.

Anyway, this knowledge helped me understand git a bit more.  So, I hope
this will help others too.

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc


___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice