takeshin
takeshin

Reputation: 50638

Import previous commits using git-svn

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?

Upvotes: 2

Views: 1069

Answers (3)

manojlds
manojlds

Reputation: 301147

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

Upvotes: 1

eykanal
eykanal

Reputation: 27017

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>.

Upvotes: 0

Cosmin Stejerean
Cosmin Stejerean

Reputation: 1398

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.

Upvotes: 1

Related Questions