Repo/DirA
Repo/DirB
Repo/DirC
現在我們想將 DirA 抽出來,獨自為一檔案庫。
製作目前檔案庫備份
$ git clone Repo temp將 remote 移除
$ cd temp
temp/:$ git remote rm origin抽出 DirA
temp/:$ git filter-branch --subdirectory-filter DirA HEAD重製檔案庫
temp/:$ cd ..
$ git clone --bare temp DirA.git
參考來源:
http://progit.org/book/ch6-4.html
Making a Subdirectory the New Root
Suppose you’ve done an import from another source control system and have subdirectories that make no sense (trunk, tags, and so on). If you want to make the
trunk
subdirectory be the new project root for every commit, filter-branch
can help you do that, too:$ git filter-branch --subdirectory-filter trunk HEAD
Rewrite 856f0bf61e41a27326cdae8f09fe708d679f596f (12/12)
Ref 'refs/heads/master' was rewritten
Now your new project root is what was in the
trunk
subdirectory each time. Git will also automatically remove commits that did not affect the subdirectory.
沒有留言:
張貼留言