lazygit's killer feature: visual interactive rebase

·cheatly.dev

Interactive rebase on the CLI means running git rebase -i, staring at a list of pick commands in your editor, changing words, saving, and hoping you didn't mess up the order. In lazygit, you do it all visually.

How it works

Open the Commits panel (4) to see your commit history. Everything happens with single keystrokes:

Rebase Actions
Ctrl-j
Move commit down
Ctrl-k
Move commit up
s
Squash into parent commit
f
Fixup — squash but discard this message
r
Reword the commit message
d
Drop the commit entirely
e
Edit — pause rebase at this commit

You see the result immediately. Move commits around, squash the noisy ones, reword the unclear messages — all before pushing.

Press z to undo. lazygit keeps its own undo history, so you can experiment freely. Accidentally dropped a commit? Undo. Squashed the wrong thing? Undo.

A common workflow

You've been working on a feature branch with messy commits — "WIP", "fix typo", "actually fix it". Before opening a PR:

  1. Open lazygit, go to Commits panel
  2. Move related commits together with Ctrl-j/Ctrl-k
  3. Squash the noise with f (fixup)
  4. Reword the remaining commits with r to tell a clean story

What used to be a multi-step git rebase -i HEAD~8 with careful text editing is now 30 seconds of pressing single keys.

When to use the CLI instead

lazygit handles daily work brilliantly. Drop back to the CLI for:

You can press e to open files in your editor directly from lazygit, and the two workflows complement each other.

Full reference: lazygit cheatsheet · git rebase deep dive.