2017-01-20 11 views
1

svn repoから作成されたgit repoがあります。最後のn個のコミットをsvnからgit repoに移動

しかし、git repoが作成された後、いくつかのものがsvnにコミットされました。

svnリビジョンごとにパッチを作成してgitにインポートすることはできますが、それは時間がかかります。

最後のn個のコミットをsvnからgitに移動する最も簡単な方法は何ですか?

答えて

2

Gitリポジトリはgit svnを使用して変換されましたか?

「はい」の場合は、git svn fetchとそれに続くマージが必要です。

もしそうでなければ、git svnを使ってSubversionリポジトリ全体を新しいものに変換し、結果のリポジトリから既存のGitリポジトリに必要なブランチを取り出し、対応するブランチへのコミットの必要な範囲をgit cherry-pickにします。

1
$ git svn init <project url> --trunk=<path to trunk> local_repo 
$ cd local_repo 
$ git svn fetch --revision=X:HEAD # where X - last revision, that was already imported to git 
$ cd ../your_actual_repo 
$ git remote add tmp ../local_repo 
$ git fetch --all 
$ # cherry pick or rebase commits, that you want 
    # from remotes/tmp/master to master, you probably 
    # want to fix them afterwards with git rebase --interactive 
$ git remote remove tmp 
関連する問題