So I want to go from this state:
A - B - C - D - E
to this state:
A (feature/1 branch)
B (feature/2 branch)
C (feature/3 branch)
D (feature/4 branch)
E * master
How do I do this? Thanks in advance.
Let P
be the parent of A
. As I understand, you want each of these commits to have P
as its parent. For each commit, create a branch there, and then rebase it by "cutting" it off from its current parent and "pasting" it onto P
:
git checkout -b feature/2 B
git rebase HEAD~1 --onto P
git checkout -b feature/3 C
git rebase HEAD~1 --onto P
and so on. A
already has P
as its parent, so you just need git branch feature/1 A
to create the branch.