git rebase [new-base]
git rebase -i main
-i
means interactive. This lets you edit the list of commits that are about to be rebased. You can condense two commits in one - use squash
or edit
to make some amendments - this basically pauses the rebase. For example, you can add your change to staging and next to include it in your edit
commit use git commit --amend
to replace the commit message. git rebase --continue
git rebase --abort
--abort
flag to discard changes and start from scratch.