Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-svn rebase and dcommit problem

Tags:

git

svn

git-svn

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,

like image 883
ant2009 Avatar asked Dec 14 '10 06:12

ant2009


4 Answers

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)
like image 83
VonC Avatar answered Nov 19 '22 03:11

VonC


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.

like image 34
Gabe Moothart Avatar answered Nov 19 '22 01:11

Gabe Moothart


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

like image 1
Thembile Avatar answered Nov 19 '22 03:11

Thembile


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.

like image 1
Kevin Dubois Avatar answered Nov 19 '22 03:11

Kevin Dubois