DEV Community

Discussion on: Git merge, git rebase, and crawling out of the git hole

Collapse
 
dcanning profile image
David Canning • Edited

I'd say the main benefit of doing squash is that you still have multiple commits in your history up until you do the squash, so if you screw something up you can still look back through your commits to either get back to before, or look at the changes to figure out what you did. With the amend, you're adding your new changes to the previous commit, so you've only got the one commit in your history the whole time, no way to look at previous commits, because there aren't any.

Thread Thread
 
ac000 profile image
Andrew Clayton

Often --amend is exactly what you want.

Maybe you need to re-word the commit message, add a Reviewed-by tag etc... or perhaps you just need to make a code change or you forgot to git add [-p] something...

I would say I use --amend a lot more often than squashing commits.

The right tool for the job and all that...