开发者

Import previous commits using git-svn

开发者 https://www.devze.com 2023-03-04 12:21 出处:网络
What I have done so far: git svn init http://example.com/svn/trunk (latest revision is 1000) git svn fetch -r1000

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开发者_Go百科 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?


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.


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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号