git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ben Bradshaw <ben@catalyst.net.nz>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: could not detach HEAD error didn't identify the cause of the issue
Date: Tue, 15 Sep 2009 09:01:28 +1200	[thread overview]
Message-ID: <4AAEAF28.2050604@catalyst.net.nz> (raw)
In-Reply-To: <4AAEAE15.7050607@catalyst.net.nz>

Hi Jeff,

I'm using git version 1.5.6.5 - I think I can elaborate on the issue
some more though. I'll step through the process that got me to the point
of failure. For the purposes of this example 'ben@carbon' is me at my
local machine, 'ben@staging' is our staging server. Our development
setup for this project has us all working on the staging server except
when we need to test something that we don't want on staging (could
break things) so I also have a local copy of staging. (This seems
backwards to me but it's working rather well for the short time line we
have).

In this case I did the following:
1. Add module site_map to carbon
2. Install and test on carbon
3. Add module site_map to staging
4. Install and test on staging
5. git commit && git push on staging
6. git pull --rebase on carbon

I think you will need two checkouts of your repo in order to trigger
this case?

Ben
>
> Jeff King wrote:
>> On Mon, Sep 14, 2009 at 12:14:24PM +1200, Ben Bradshaw wrote:
>>
>>   
>>> I was asked to post this issue to the list, I've just had git tell me it
>>> can't detach HEAD which left me scratching mine as to the cause and fix.
>>> Turns out if I have local untracked files that the remote branch also
>>> has then this error will trigger. I have included my shell backlog
>>> (client data removed). In this example the site_map folder was present
>>> on master and I had a local, untracked copy.
>>>
>>> git can obviosly detect this issue and stop my local copy getting in a
>>> bad state, but an error message such as "sites/all/modules/site_map/ is
>>> present in HEAD but is untracked locally, unable to apply changes" (or
>>> something to point the finger) would be much appreciated.
>>>     
>>
>> I couldn't reproduce it here; I get such a message.
>>
>>   # set up forked repo, "another" exists only on master
>>   $ mkdir repo && cd repo
>>   $ git init
>>   $ echo content >file && git add file && git commit -m base
>>   $ echo content >another && git add another && git commit -m another
>>   $ git checkout -b other HEAD^
>>   $ echo changes >file && git commit -a -m changes
>>
>>   # add untracked "another" here
>>   $ echo untracked >another
>>
>>   # try rebase
>>   $ git rebase master
>>   First, rewinding head to replay your work on top of it...
>>   error: Untracked working tree file 'another' would be overwritten by merge.
>>   could not detach HEAD
>>
>>   # try git pull --rebase, in case it hides the message
>>   $ git config branch.other.remote .
>>   $ git config branch.other.merge refs/heads/master
>>   $ git pull --rebase
>>   From .
>>    * branch            master     -> FETCH_HEAD
>>   First, rewinding head to replay your work on top of it...
>>   error: Untracked working tree file 'another' would be overwritten by merge.
>>   could not detach HEAD
>>
>> I'll admit the "could not detach HEAD" message would probably be better as:
>>
>>   rebase: unable to move HEAD to 'master', aborting rebase
>>
>> or something similar.
>>
>> What version of git are you using? What does my test case above produce
>> for you?
>>
>> -Peff
>>
>>   

  parent reply	other threads:[~2009-09-14 21:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-14  0:14 could not detach HEAD error didn't identify the cause of the issue Ben Bradshaw
2009-09-14 11:22 ` Jeff King
     [not found]   ` <4AAEAE15.7050607@catalyst.net.nz>
2009-09-14 21:01     ` Ben Bradshaw [this message]
2009-09-14 22:39       ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AAEAF28.2050604@catalyst.net.nz \
    --to=ben@catalyst.net.nz \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).