Git と A successful Git branching model の練習のためSourceForgueのSubversionレポジトリにあるxtalgrowthを GitHubへ移動させる。ssh-keyは双方について適宜設定されているものとする。
もっと冴えたやりかた等、ご意見募集中。
- http://dqn.sakusakutto.jp/2012/10/svn-git-github-migration.html 仕事で使ってる巨大SVNレポジトリをGithubに移管するためにやったことまとめ
- https://www.atlassian.com/ja/git/migration Gitチュートリアル Gitへの移行
- http://qiita.com/ironsand/items/6c301fef730d53f35bc3 git push -u オプションの意味
- https://gist.github.com/t-nissie/05023a36c7694c1effd5 RubyForgeのSubversionレポジトリからGitHubへの引越
trunkは5.8MB程度。画像が何枚かあるので大きめ。 lotoプロジェクトのサブプロジェクトになっていた。 tagとbranchは作らなかった。
$ pwd
/Users/takeshi/f/loto/xtalgrowth/trunk
$ svn info .
Path: .
Working Copy Root Path: /Users/takeshi/f/loto
URL: https://svn.code.sf.net/p/loto/code/xtalgrowth/trunk
Repository Root: https://svn.code.sf.net/p/loto/code
Repository UUID: 66b5f4e2-d06a-45f9-b3fd-3971e49ba91e
Revision: 2998
Node Kind: directory
Schedule: normal
Last Changed Author: t-nissie
Last Changed Rev: 2998
Last Changed Date: 2017-10-15 09:03:47 +0900 (Sun, 15 Oct 2017)
$ du -sh .
5.8M .
/Users/takeshi/authors.txtを用意。 このファイルの場所は .git/config に書かれるのでいつでも変更可能。
t-nissie = t-nissie <t-nissie@example.com>
とりあえずgit svn clone
。
ディレクトリ xtalgrowth/ が作られるはず。
$ git svn clone --stdlayout --authors-file=/Users/takeshi/authors.txt --prefix=svn/ https://svn.code.sf.net/p/loto/code/xtalgrowth
Initialized empty Git repository in /Users/takeshi/c/xtalgrowth/.git/
Using higher level of URL: https://svn.code.sf.net/p/loto/code/xtalgrowth => https://svn.code.sf.net/p/loto/code
W: Ignoring error from SVN, path probably does not exist: (160013): Filesystem has no item: File not found: revision 100, path '/xtalgrowth'
W: Do not be alarmed at the above message git-svn is just searching aggressively for old history.
This may take a while on large repositories
Checked Ahrough README-ja
A src/rand_ary.c
A src/xtalgrowth.c
A src/rand_ary.h
:
$ cd xtalgrowth
$ ls -la
$ git branch -a
* master
remotes/svn/trunk
GitHubにWebから中身のないリポジトリを作くる。
そこにgit push
する。
2行目の--set-upstreamにより、次回から git push
が git push origin master
と等価になる。
$ git remote add origin git@github.com:t-nissie/xtalgrowth.git
$ git push --set-upstream origin master
$ git branch -a
$ git branch -a
* master
remotes/origin/master
remotes/svn/trunk
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
引越し先はここ → https://github.com/t-nissie/xtalgrowth
もちろん他所でgit clone
できる。
$ git clone git@github.com:t-nissie/xtalgrowth.git
$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master