Git Rebase
Rewriting commit history
Basic Rebase
git checkout feature # switch to feature branch
git rebase main # rebase onto main
git rebase --continue # continue after resolving conflicts
git rebase --abort # cancel rebase
Interactive Rebase
git rebase -i HEAD~3 # rebase last 3 commits
git rebase -i # rebase from specific commit
Rebase Commands
pick # use commit
reword # edit commit message
edit # stop for amending
squash # combine with previous commit
fixup # like squash but discard message
drop # remove commit
Rebase onto
git rebase --onto main feature old-feature # move commits