1.Enable --autosquash in global settings
git config --global rebase.autosquash true
2.When you want to create a fix to former commit
git commit --fixup=<commit>
Then a commit message starts with fixup!
will be created
3.Run git rebase, then it will auto squash the fixup
git rebase -i HEAD~2