2

What I have done so far:

git svn init http://example.com/svn/trunk

(latest revision is 1000)

git svn fetch -r1000
git svn rebase

My repo is up to date and I have in the logs all commits since rev. 1000.

How to import the history since revision 800?
How to checkout to the revision 800?

takeshin
  • 49,108
  • 32
  • 120
  • 164

3 Answers3

1

To find the commit hash for a particular svn revision you can do

git svn find-rev r800

However, that will only help you once you have the subversion commits in your git repository. The best option is generally to get a checkout that includes the entire subversion history.

git svn clone http://example.com/svn/trunk

Or if you want, all branches as well as trunk

git svn clone -s http://example.com/svn/

If you want to continue down the current path (which will be painful) you can get a second git repository that includes more revisions than the current one, and then graft them together using git grafts. So for example if you are certain that you only want revision 800 you can do another

git svn init http://example.com/svn/trunk git svn fetch -r 800

However, if you then want revision 600, 400, 900, etc, you will forever have to mess with your local git repository. Better to just start over, get a proper git svn checkout that includes all revisions and then you can freely check out arbitrary revisions without having to jump through hoops.

Cosmin Stejerean
  • 1,348
  • 9
  • 9
1

You can do:

git svn fetch -r1000:HEAD
git svn rebase

You will get those commits in as well.

Git svn clone: How to defer fetch of revision history

Community
  • 1
  • 1
manojlds
  • 290,304
  • 63
  • 469
  • 417
0

I don't know how to solve the first problem, but regarding the second, it's as simple as finding the commit hash tag for that revision and typing git checkout <commit tag>.

eykanal
  • 26,437
  • 19
  • 82
  • 113
  • I can't find a reference to --depth on git svn fetch anywhere. What version of git are you using? – Cosmin Stejerean May 09 '11 at 14:44
  • @cosmin - I'm sorry, I didn't see the git-svn tag. That part of the answer is wrong. However, the documentation for [`git-svn fetch`](http://www.kernel.org/pub/software/scm/git/docs/git-fetch.html) says it should "Fetch unfetched revisions from the Subversion remote we are tracking." Maybe just try using it by itself, without the `-r` tag? – eykanal May 09 '11 at 15:15