< up >
2022-02-11

git: split commits

Is that branch commit list familiar to you?

pick a70ebde big commit with major feature update
pick e561140 minor change
pick e3dfbbe minor change
pick 5648ef4 minor change

That one big commit a70ebde that should better be several smaller ones?

  1. edit commit via rebase:
    • git rebase -i <main branch>
    • replace pick with edit or e of the big commit
  2. reset commit (softly!) via git reset HEAD^
  3. commit everything separately
  4. finish rebase: git rebase --continue

If you get stuck in any stage, just abort the process with git rebase --abort.