Created
May 25, 2026 20:21
-
-
Save copyleftdev/e6cb7c8e362230c7d60271240ae3298c to your computer and use it in GitHub Desktop.
git commit --fixup and git rebase --autosquash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # git commit --fixup + git rebase --autosquash | |
| # Fix any past commit cleanly — no painful interactive rebase editing. | |
| # Spot a typo in the third commit back: | |
| git add the-fix.rs | |
| git commit --fixup HEAD~2 | |
| # creates: "fixup! <original commit message>" | |
| # Let autosquash reorder + squash automatically: | |
| git rebase -i --autosquash main | |
| # The fixup is already placed below its target in the todo list. | |
| # Just save and close — no editing needed. | |
| # ── Make this the default globally ──────────────────────────── | |
| git config --global rebase.autoSquash true | |
| # Now plain `git rebase -i` always applies autosquash behaviour. | |
| # ── fixup! vs squash! ───────────────────────────────────────── | |
| # --fixup → silently squashes, keeps original message | |
| # --squash → squashes and opens editor to combine messages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment