You cannot directly squash earlier commits whilst retaining later ones.
Instead you need to create a picking branch, do some reset operations, re-commit the intermediary changes,
and cherry-pick over the relevant commits. You must start from a clean state - no modifications, no staged
items, no untracked files. Working tree clean
must appear in your git status
.
Below, my-branch-name
is the name of the branch you are on.