如何将每个过去的提交放在其自己的单独分支上?
How to put each past commit on a separate branch of its own?
所以我想离开这个状态:
A - B - C - D - E
到这个状态:
A (feature/1 branch)
B (feature/2 branch)
C (feature/3 branch)
D (feature/4 branch)
E * master
我该怎么做?提前致谢。
设 P
为 A
的父级。据我了解,您希望每个提交都将 P
作为其父项。对于每个提交,在那里创建一个分支,然后通过 "cutting" 将其从当前父级和 "pasting" 重新设置为 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
等等。 A
已经有 P
作为它的父级,所以你只需要 git branch feature/1 A
创建分支。
所以我想离开这个状态:
A - B - C - D - E
到这个状态:
A (feature/1 branch)
B (feature/2 branch)
C (feature/3 branch)
D (feature/4 branch)
E * master
我该怎么做?提前致谢。
设 P
为 A
的父级。据我了解,您希望每个提交都将 P
作为其父项。对于每个提交,在那里创建一个分支,然后通过 "cutting" 将其从当前父级和 "pasting" 重新设置为 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
等等。 A
已经有 P
作为它的父级,所以你只需要 git branch feature/1 A
创建分支。