I would like to obliterate a series of git commits between two points, we’ll call these the START and END commits.
First, determine the SHA1 for the two commits, we’ll be forcefully deleting everything in between and preserving the END exactly as it is.
Detach Head
Detach head and move to END commit,
git checkout SHA1-for-END
Reset
Move HEAD to START, but leave the index and working tree as END
git reset --soft SHA1-for-START
Redo END commit
Redo the END commit re-using the commit message, but on top of START
git commit -C SHA1-for-END
Rebase
Re-apply everything from the END
git rebase --onto HEAD SHA1-for-END master
Force Push
push -f