= gitリポジトリのサブディレクトリを新しいリポジトリに分割 = [[http://stackoverflow.com/questions/359424/detach-subdirectory-into-separate-git-repository|git filter branch - Detach subdirectory into separate Git repository - Stack Overflow]]を参考に作業した。 {{{ $ git clone --bare --no-hardlinks moinmoin-hack.git yamlbbs.git Cloning into bare repository yamlbbs.git... done. $ cd yamlbbs.git/ $ chmod -R g+w . $ vim config [core] repositoryformatversion = 0 filemode = true bare = true + sharedrepository = 1 -[remote "origin"] - url = /export/repositories/git/moinmoin-hack.git $ git filter-branch --subdirectory-filter yamlbbs -- --all Rewrite c2ff2ea34f0ca84ee1ff29afbc8d48eb44fe79e3 (20/20) Ref 'refs/heads/master' was rewritten $ rm -r refs/original/ $ git reflog expire --expire=now --all $ git gc --aggressive --prune=now Counting objects: 20, done. Delta compression using up to 8 threads. Compressing objects: 100% (20/20), done. Writing objects: 100% (20/20), done. Total 20 (delta 0), reused 0 (delta 0) }}} なお、古い`moinmoin-hack`リポジトリは`yamlbbs`以外に入っていないので削除した。 = yamlbbsの適当なリビジョンを安定版として運用する = まずstableブランチを作ってpushする。 {{{ $ git branch stable HEAD $ git push origin stable Enter passphrase for key '/home/ytoku/.ssh/id_rsa': Total 0 (delta 0), reused 0 (delta 0) To ssh://nest/export/repositories/git/yamlbbs.git * [new branch] stable -> stable }}} 本番環境ではstableブランチを追いかけるようにする。 {{{ $ git clone -b stable /export/repositories/git/yamlbbs.git $ chmod -R g+w yamlbbs/ $ vim yamlbbs/.git/config (sharedrepository=1) }}}