DEV Community

Discussion on: A closer look at git rebase

Collapse
 
jandedobbeleer profile image
Jan De Dobbeleer •

You can also use git commit --fixup <hash> to prepare a fixup (or squash using --squash). They will be added on top of your branch so you still have to do a rebase using git rebase -i --autosquash to do the fixup or squash. I use this a lot to quickly fix PR review comments or mistakes I made along the way.

Collapse
 
lt0mm profile image
Tom • • Edited


git commit --amend --no-edit

is also useful in such cases, which simply adds your changes to previous commit,


 tells git to leave previous commit message
Collapse
 
jandedobbeleer profile image
Jan De Dobbeleer •

Yup, but that only goes for the last commit whereas a fixup can blend into any commit after a rebase.

Thread Thread
 
lt0mm profile image
Tom •

Really neat, I didn't understand initially what it is

Thread Thread
 
jeklah profile image
Jeklah •

Very useful when you're using cli to commit with a message, but the commit message turns out too long so you shorten it, then can go to --amend --no-edit to extrapolate on the initial brief commit message. This is my most common use for this.

My second is forgetting to mention a change in a commit.