Split git branch into separate repo
git
Solution
The following assumes you have your two separate new repos set up as remotes named `repo_v1` and `repo_v2`.
The v1 branch is easy:
git push repo_v1 ref_c:v1
The v2 branch isn't that hard:
git checkout --orphan v2 ref_b
git cherry-pick ref_b..ref_d
git push repo_v2 v2
(`git checkout --orphan <branchname> <startpoint>` creates an entirely new history that starts from the specified point but doesn't have any of that commit's parents.)
Problem
I have the following git tree : ``` branch v2 => / --- [lots of work] --- [new version] --- ref_d / root --- ref_a --- ... --- ref_b (project reset) \ branch v1 => \ --- [some works] --- ref_c ``` As v1 and v2 are really different, two different team will maintain v1 and v2, I would like two separate branch two to different git repository as : ``` repo_v1 : from root to ref_c repo_v2 : from ref_b to ref_d ``` How should I do this ? Thanks.