git-svn利用時SubversionのリポジトリURLが変更になった時の対応

git svn 環境でのリポジトリ再配置 ( svn switch --relocate に代わる何か ) - do_aki's log
上記URLの情報を最初に見つけて最終的にはGitオフィシャルのWikiにたどり着いた。

  • Edit the svn-remote url URL in .git/config to point to the new domain name
  • Run git svn fetch - This needs to fetch at least one new revision from svn!
  • Change svn-remote url back to the original url
  • Run git svn rebase -l to do a local rebase (with the changes that came in with the last fetch operation)
  • Change svn-remote url back to the new url
  • Run git svn rebase should now work again!

This will only work, if the git svn fetch step actually fetches anything! (Took me a while to discover that... I had to put in a dummy revision to our svn repository to make it happen!)

GitSvnSwitch - Git SCM Wiki
  1. .git/configを編集してsvn-remote urlを新URLに変更
  2. git svn fetch
  3. .git/configを編集してsvn-remote urlを旧URLに変更
  4. git svn rebase -l
    • オプションlは--localの略。fetchしてある情報からrebaseするということだと思うがなんで実行前に元のリポジトリURLに戻す必要があるのか。
  5. .git/configを編集してsvn -remote urlを新URLに変更
  6. git svn rebaseが動作するようになる!

これが動作するのはgit svn fetchで何らかの変更を取得できた時のみである(それを発見するのに時間がかかった。私はダミーのリビジョンをでそれを実現した。)
ようするにgit svn fetchで何らかの変更を取得しないと成功しないみたいだから、svn側で何でもいいからコミット作ってリビジョンを進めるといいみたいね。