* could not detach HEAD error didn't identify the cause of the issue
@ 2009-09-14 0:14 Ben Bradshaw
2009-09-14 11:22 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Ben Bradshaw @ 2009-09-14 0:14 UTC (permalink / raw)
To: git
Hi,
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.
ben@carbon:redacted/$ git pull --rebase
remote: Counting objects: 91, done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 74 (delta 27), reused 0 (delta 0)
Unpacking objects: 100% (74/74), done.
From git+ssh://redacted
fb1a4c9..bf06bbd master -> origin/master
First, rewinding head to replay your work on top of it...
Fast-forwarded master to bf06bbd9e50a2732164fba9e60e65606ab1267ab.
ben@carbon:redacted/$ pwd
/home/ben/redacted
ben@carbon:redacted/$ git pull --rebase
First, rewinding head to replay your work on top of it...
could not detach HEAD
ben@carbon:redacted/$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# sites/all/modules/jquery.ui-1.6.zip
# sites/all/modules/jquery_ui-6.x-1.3.tar.gz
# sites/all/modules/jquery_ui/
# sites/all/modules/modalframe-6.x-1.3.tar.gz
# sites/all/modules/modalframe/
# sites/all/modules/nodereference_explorer-6.x-1.1-beta6.tar.gz
# sites/all/modules/nodereference_explorer/
# sites/all/modules/noderelationships-6.x-1.1.tar.gz
# sites/all/modules/noderelationships/
# sites/all/modules/site_map-6.x-1.1.tar.gz
# sites/all/modules/site_map/
nothing added to commit but untracked files present (use "git add" to track)
ben@carbon:redacted/$ rm -rf sites/all/modules/site_map/
ben@carbon:redacted/$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# sites/all/modules/jquery.ui-1.6.zip
# sites/all/modules/jquery_ui-6.x-1.3.tar.gz
# sites/all/modules/jquery_ui/
# sites/all/modules/modalframe-6.x-1.3.tar.gz
# sites/all/modules/modalframe/
# sites/all/modules/nodereference_explorer-6.x-1.1-beta6.tar.gz
# sites/all/modules/nodereference_explorer/
# sites/all/modules/noderelationships-6.x-1.1.tar.gz
# sites/all/modules/noderelationships/
# sites/all/modules/site_map-6.x-1.1.tar.gz
nothing added to commit but untracked files present (use "git add" to track)
ben@carbon:redacted/$ git pull --rebase
First, rewinding head to replay your work on top of it...
Fast-forwarded master to 527afccc7565929baf7890b42b1a34174014fee7.
Thanks for your time (and git)
Ben
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: could not detach HEAD error didn't identify the cause of the issue
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>
0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2009-09-14 11:22 UTC (permalink / raw)
To: Ben Bradshaw; +Cc: git
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-14 22:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2009-09-14 22:39 ` Jeff King
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.