如何作为单独的分支+合并提交中断git提交的子序列

Jam*_*ber 5 git

什么非交互式git命令实现从Before到After(其中BC是合并提交)的更改

之前:

A---B---C---D
Run Code Online (Sandbox Code Playgroud)

后:

  B---C
 /     \
A-------BC---D'
Run Code Online (Sandbox Code Playgroud)

mip*_*adi 5

这是我要做的:

$ git branch to-merge-in C-commit-ID    # Create a branch at C
$ git reset --hard A-commit-ID          # Reset current branch to A
$ git merge --no-ff to-merge-in         # Merge in branch. Create a merge commit.
$ git cherry-pick D-commit-ID           # Grab the commit D
Run Code Online (Sandbox Code Playgroud)