brewly — Ch.6 · Squash your corrections
Exercise 5 of 8
Before you start
Folding commits together
In the todo list, squash melts a commit into the one above it and lets you edit the combined message. fixup does the same but throws the small commit’s message away.
For a correction you are about to commit, git commit --fixup <commit> names its target. --autosquash then puts it in the right place of the list for you.
Move other lines yourself so they sit right below their target.
- git add <file>
- stage the correction
- git commit --fixup <commit>
- commit it as a fix for that commit
- git rebase -i --autosquash main
- edit the list, fixups already placed
- git log --oneline
- check the result
You can reopen this any time with “Lesson”.
.gift {color: gold;}
Graph
- 561a9f7 typoHEAD → feature/gift-cards
- 9c9d713 Style gift cards
- 10323e0 Add gift cards
- 1354d06 Add menu pageorigin/mainmain
- 619eb3b Style the order button
- 5fc44ac Initial commit