Friday, September 17, 2010

How to rewind ("back up") a git-svn repo

My company uses Subversion for most of its version control needs. But, I find I like the flexibility git affords me better. So, I've been using git, via git-svn, for some time now, with generally only a few problems.

However, not long ago I transfered a repository to another computer, and messed up my git settings (I set AutoCrLf to true... oops).

Anyway, this messed up my repo pretty good, to the point that I couldn't even do a git svn rebase without it failing with the error "Incomplete data: Delta source ended unexpectedly"

Turns out, in order to fix this, you have to re-get the entire repository, or at least without re-getting the commits that were checked out with AutoCrLf (remember, I had the git repo from another computer, so most of the history was good).

So, how do you rewind git-svn to a particular revision?

Thanks to the handy git-svn documentation:

git svn reset -r [svn revision number] -p

And then, just git svn rebase as normal.