Let’s say you added the baisc code for the story you’re working on with a simple message of “enable sso,” then you pushed it.
A few moments later, you realised a typo, so you pushed a fix of this typo with another message of “fix typo” and when your peer started reviewing your PR, he/she pointed out that there were some unnecessary files that needed to be cleaned out.
Finally, you pushed a third fix of the clean out ask, now you want your PR itself to look clean and consolidate those 3 commits in the original one.
The commits respecticly are:
- enable sso
- fix typo
- clean out
The commit tree look like this
Execute the following rebase commands in your local command shell or terminal
|
|
An interactive screen will open in your default editor; I use vim, but yours may differ. At the interactive screen, choose fixup for commits 2 and 3, by adding f in front of those commits, while leaving the pick in front of the main commit.
You can now push your branch by including a leading plus before the branch name, as below
|
|
Here is how the commit tree look like after rebase