$ git rebase -i 5ha01
# Ctrl+C (break)
$ git reflog
> 5ha20 (HEAD -> master) HEAD@{0}: rebase (finish): returning to refs/heads/master
> 5ha20 (HEAD -> master) HEAD@{1}: rebase (start): checkout 5ha01
> 5ha01 HEAD@{n}: commit (initial): Add .gitignore file
$ git reset --hard HEAD@{n}
reset --hard HEAD@
https://www.w3docs.com/snippets/git/undoing-a-git-...$ git log --graph --format=%s
# Before After
# A---B---C---D---E---F (HEAD branch) A---B---E'---F' (HEAD branch)
$ git rebase --onto B D
$ git push --force
rebase --onto
https://womanonrails.com/git-rebase-onto#removing-...