DEV Community

Discussion on: Pick. Squash. Drop. Rebase! (Comic)

Collapse
 
aptituz profile image
Patrick Schönfeld • Edited

One of the most useful things I learned for my workflow is git commit —fixup - because often enough I know in advance what is just a correction of a previous commit. I can then automatically cleanup history with git rebase —autosquash.

Collapse
 
jln profile image
JLN

Why not just ammend it to the previous commit?

Collapse
 
aptituz profile image
Patrick Schönfeld

Because fixup also works for other commits in the history. Like when I am working on a branch with multiple commits that represent different logical changes and I find an issue with it. Then I can fixup the commit it belongs to and retain a clean history.

Thread Thread
 
aptituz profile image
Patrick Schönfeld

(Of course I am talking about multiple commits that have not yet been merged anywhere else)