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
- Open
.git/logs/HEAD
- 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
- Confirm that the commit you found is the right one: git show
git reset --hard hash from log
git svn rebase
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.
Step 4 should read something like “git reset –hard “, shouldn’t it?
Thanks Mike. Fixed now.
“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.