How to split an earlier git commit into multiple ones
Published:
As usual, keep having to google this, so finally writing it down here...
Last commit
Simply do git reset HEAD~
and make new commits as needed.
Commit further back
- Perform an interactive rebase (e.g.
git rebase -i main
), and change the commit frompick
toedit
. - Reset the commit with
git reset HEAD~
. - Make new commits as needed.
- Complete the rebase with
git rebase --continue