Saving your neck when git-svn dcommit fails

Over the weekend I had to send some changes to an SVN repo. Thing is that I use git-svn to have all those XXI century benefits like local commits.

Sadly I had some problems with git-svn, concretely it failed half the way through sending my really big number of changes. The result was that I was left with uncommitted changes and missing commits after such set of changes. No need to say that I was really nervous about the state of my hard work of the week…

So after some desperate google searches and some questions to my personal GIT expert, desrt, I found this mail in google groups. I reproduce the process here:

How to save your neck when git-svn dcommit fails half through the process

  1. Open .git/logs/HEAD
  2. Look for your most recent commit (note that these commits are sorted by “unix time”, although you can also find the latest one by reading the shortlog there
  3. Confirm that the commit you found is the right one: git show
  4. git reset --hard hash from log
  5. git svn rebase
  6. git svn dcommit

This picks up where it left off, so you won’t loose anything, happy happy happy git :-).

Hope this saved your neck like it saved mine. Other tips welcome :-)!

Update: Mike lets me know that the commands were bad written because of html entities and stuff, fixed now.

This entry was posted in English, planetgnome, Tips and tagged , , , . Bookmark the permalink.

3 Responses to Saving your neck when git-svn dcommit fails

  1. Mike says:

    Step 4 should read something like “git reset –hard “, shouldn’t it?

  2. diegoe says:

    Thanks Mike. Fixed now.

  3. Steven Walter says:

    “git log -g” is a nicer form of “open .git/logs/HEAD”. “log -g” shows the ref log, for HEAD by default, but you can also limit the reflog to any given branch. That’s usually more useful, but you do in fact want HEAD in your case.

Comments are closed.