First do:
git rebase -i A
This will show the list of commits in a text editor, starting with B and ending with K.
You will need to change the pick text before committing C, D, E, F, H and J to s or squash . Do not change pick before B or K. Note that there should be no commit G, because this is a merge commit.
Finally, save and exit the editor. This will begin a real reboot.
The result will be like this:
AZK' (master) \ BC
A part that does not have a branch will eventually be deleted by garbage collection.
source share