Skip to content
Versora
All features

Commit surgery

Fix old commits without memorizing a single command.

The problem

Found a mistake three commits back? Putting the fix in the right place usually takes an interactive rebase, a fixup and a lot of care.

7 features

A well-kept branch tells a story, with each commit doing one thing. In practice, the fix for an old commit shows up later, and putting it in the right place takes git commit --fixup, git rebase -i --autosquash and care not to lose anything. Versora's commit surgery does this from the commit menu and from the bar below “Commit options”.

You choose what to fix, and the app builds the rebase, with no text editor and no need to memorize the order of the commits. Requires git 2.40 or newer.

Step by step

How it works in Versora

1Step 1 of 5

Absorb

Made small fixes in different parts of the branch? Stage everything and use “Absorb…”: each hunk goes to the commit that last touched those lines.

The preview shows each hunk's target and lets you change the target or keep the hunk staged.

The command this replaces
In the terminal4×
git blame -L 18,22 src/routes/pedidos.tsgit commit --fixup=4c9c3e0git commit --fixup=bae0e4fgit rebase -i --autosquash main
In Versora · one action

“Absorb…”: each hunk goes to its own commit.

2Step 2 of 5

Commit as fixup of…

“Commit as fixup of…” looks at the blame of the staged lines and finds the original commit on its own. You apply the fix right away or leave a fixup! commit for later.

Whenever you're ready, “Apply pending fixups”, in the current branch's menu, squashes them all in one go.

The command this replaces
In the terminal3×
git blame -L 18,22 src/routes/pedidos.tsgit commit --fixup=4c9c3e0git rebase -i --autosquash main
In Versora · one action

“Commit as fixup of…”: the app finds the commit for you.

Changes panel with staged and unstaged files, a diff with per-hunk buttons and a filled-in commit box
3Step 3 of 5

Move changes between commits

Drag a file from a commit's file list, or a hunk's “Move…” button, onto another commit of the branch in the graph. Dropped in the middle of the row, it goes into that commit; on the top or bottom edge, it becomes a new commit right above or right below.

Lines picked in the diff can be moved too, from the menu. Beforehand, the plan says what moves where, which branches will need a force push and where the operation might stop on a conflict.

4Step 4 of 5

Split commit

A commit that does two things becomes two, or more. “Split commit…” lets you pick lines, hunks or whole files for each part, and each part gets its own message.

History becomes easier to review, without redoing the work.

The command this replaces
In the terminal6×
git rebase -i maingit reset HEAD~git add -pgit commit -m "…"git commit -m "…"git rebase --continue
In Versora · one action

“Split commit…” and pick the lines for each part.

5Step 5 of 5

A single rebase, with a plan

Under the hood, each of these operations is a single rebase. The plan comes first, a conflict opens in the usual conflict editor and “Abort” leaves everything as it was.

The commits above and the branches in the stack follow along, and Ctrl+Z reverts every branch and the stage.

The command this replaces
In the terminal1×
git rebase -i --autosquash --update-refs main
In Versora · one action

Check the plan and confirm. Ctrl+Z undoes it all.

And there's more

2 more Surgery features

Grouped by who gets the most out of them. Open a feature to see the details.

You'll like these if you…

rewrite history

  • Surgery · 3df0d74

    Amend and squash mid-branch

    Amend a commit in the middle of the branch with what's staged, or squash it into the previous commit.

  • Surgery · f71f097

    Uncommit

    Take a commit out of the middle of the branch and bring its changes back to the stage.