Split two or more git branches into separate subdirectories of the same repo?

This question is somewhat similar to How to merge two branches from two different repositories in one repository? .

However, I want to merge two branches from the repository of the same into one branch, but in separate subdirectories. So, starting with one repo having two branches:

/appFoo
  -MasterBranch
  -OtherVersionBranch

And ending with a repo with one branch (master) and two subdirectories:

/appFoo
    /MasterSubdirectory
    /OtherVersionSubdirectory

And of course, I would like to keep the stories intact, so if I look at the file log in OtherVersionSubdirectory , I see all the commits that were made for this branch.

, , , , .

!

+3
1

MasterBranch MasterSubdirectory, commit:

git checkout MasterBranch
mkdir MasterSubdirectory
git mv -k * MasterSubdirectory
git commit -a

, .

OtherVersionBranch:

git checkout OtherVersionBranch
mkdir OtherVersionSubdirectory
git mv -k * OtherVersionSubdirectory
git commit -a

git checkout MasterBranch
git merge OtherVersionBranch
git branch -d OtherVersionBranch

MasterBranch. master , .

, merge rebase, . - , .

. , .

+3

Source: https://habr.com/ru/post/1752705/


All Articles