git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git svn rebase - could not detach HEAD

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 7, 2008, 07:20 UTC
Message-ID
<7vd4kljnpn.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<f7d8f60b0808062349q92fffb9l33de5550250e4e13@mail.gmail.com>
"Tony Stubbs" <antony.stubbs@gmail.com> writes:
> $ git svn rebase
> First, rewinding head to replay your work on top of it...
> could not detach HEAD
> rebase refs/remotes/git-svn: command returned error: 1

It is somewhat unfortunate that git-svn does not say anything about what ref it is trying to rebase onto here. I do not use git-svn nor know much about the code myself, but here are some ideas.

 * Try "rebase --dry-run" and see what you see from this part of the code:
        sub cmd_rebase {
                ...
                if ($_dry_run) {
                        print "Remote Branch: " . $gs->refname . "\n";
                        print "SVN URL: " . $url . "\n";
                        return;
                }
   Most interesting is what $gs->refname is;
 * If you are using recent enough git (I think 1.5.2 is Ok), update your
   copy of git-rebase like this, so that you would at least see *why* you
   cannot detach HEAD.  It is possible that git-svn is giving a nonsense
   ref to detach to.
diff --git a/git-rebase.sh b/git-rebase.sh
index e2d85ee..7825f88 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -376,9 +376,7 @@ fi
 
 # Detach HEAD and reset the tree
 echo "First, rewinding head to replay your work on top of it..."
-git checkout "$onto^0" >/dev/null 2>&1 ||
-	die "could not detach HEAD"
-# git reset --hard "$onto^0"
+git checkout -q "$onto^0" || die "could not detach HEAD"
 
 # If the $onto is a proper descendant of the tip of the branch, then
 # we just fast forwarded.
Previous: Tony StubbsNext: Tony Stubbs
Message 3 of 7 in “git svn rebase - could not detach HEAD”
  1. Tony StubbsAug 7, 2008
  2. Tony StubbsAug 7, 2008
  3. Junio C HamanoAug 7, 2008
  4. Tony StubbsAug 7, 2008
  5. Björn SteinbrinkAug 7, 2008
  6. Tony StubbsAug 7, 2008
  7. Daniel BarkalowAug 7, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.