8
git version 1.7.1
svn, version 1.6.12
Ubuntu 10.10

I have just git and I have used svn. But I haven't used then together. I had a git repository, and I had to more my repository to a subversion one. So I have been using git-svn. Which works ok, most of the time. However, I find going round in circles.

I am the only one working on this project.

I make some changes to my branch. I then stage them:

git stage gateway.c

Then commit them locally to git:

git commit m"Made some changes"

Then I want to commit them to subversion. Get the latest updates:

git svn rebase

Then I get the following message:

It seems that I cannot create a rebase-apply directory, and
I wonder if you are in the middle of patch application or another
rebase.  If that is not the case, please
        rm -fr /home/joe/projects/gateway/.git/rebase-apply
and run me again.  I am stopping in case you still have something
valuable there.
rebase refs/remotes/trunk: command returned error: 1

I then doing the following:
rm -fr /home/joe/projects/gateway/.git/rebase-apply

Then I do a rebase again:

git svn rebase

The message is this:

First, rewinding head to replay your work on top of it...
Applying: Issue with getting the port from the user context.
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging driver.c
Auto-merging gateway.c
CONFLICT (content): Merge conflict in gateway.c
Failed to merge in the changes.
Patch failed at 0001 Issue with getting the port from the user context.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

rebase refs/remotes/trunk: command returned error: 1

Which puts me on a branch called, and what is this branch and what is it for?:

*(no branch)

I then resolve the conflicts to that branch. I then checkout my play_video branch. I try to make a another:

svn git dcommit

And I end up going round in circles again.

Before I start pulling my hair out, can some offer me some advice,

Many thanks for any suggestions,

ant2009
  • 27,094
  • 154
  • 411
  • 609

4 Answers4

3

No a complete answer, but what seems certain is that:

*(no branch)

means you end up in a DETACHED HEAD mode which you see in a git svn context in "Can I recover lost commits in a SVN repository using a local tracking git-svn branch?".
See also "Why did git detach my head?".

So make sure:

  • at each step you are not in a detached HEAD (no branch)
  • that you dcommit a branch which exists in your SVN repo (and not a pure local Git branch)
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • i found myself stuck here and i tried doing a bunch of different git commands, but in the ended up running git svn dcommit before I was able to do any further svn merging. – hellatan Apr 23 '12 at 17:04
  • @dtan: is there any issue or error message you would need help with? – VonC Apr 23 '12 at 17:09
  • @VonC - no, i ran into this issue a long time ago as well and then ran into it again more recently. I just know it wasn't fun trying to decipher what was going on, but now i at least know what to do when i hit this issue again. thanks though – hellatan Apr 26 '12 at 21:43
  • This Answer is not correct, any time you have an incomplete rebase (svn or otherwise) you are left in a detached head. I'm also having problems with git merges and the subsequent 'git svn rebase'. – Quartz Jul 24 '13 at 18:04
1

Did you use the Google instructions here to import your git repo to svn? I had a similar error after using those instructions: the initial import went fine, but something went wrong somewhere down the line and I couldn't push subsequent commits.

I resolved it by just git svn init-ing a fresh git repo to track my svn repo.

Gabe Moothart
  • 31,211
  • 14
  • 77
  • 99
1

I'm running into a similar problem, likely because I pushed to my git remote before pushing to the SVN remote and thus messed up my git history. It seems like each time I try to commit something to svn, git tries to replay ALL my previous commits even though they already exist in svn, so I just do git rebase --skip until I get back to the latest commit, but the easiest solution is probably to just clone a fresh git svn.

Kevin Dubois
  • 370
  • 5
  • 5
  • Thinking about it 2 seconds more, I realized I was pulling from my remote git each time after I had pushed to svn, which pulled down the wrong git history again. I did a force push to the git remote which straightened out the history discrepancy once and for all, and the rebase issue has gone away now. – Kevin Dubois May 16 '18 at 11:56
1

After resolving your conflicts you need to run git rebase --continue before running git svn dcommit

Echilon
  • 10,064
  • 33
  • 131
  • 217
Thembile
  • 11
  • 1