git rebase(1) -i --preserve-merges --autosquash
Forward-port local commits to the updated upstream head
-i, --interactive
    Make a list of the commits which are about to be rebased. Let the user edit that list before
    rebasing. This mode can also be used to split commits (see SPLITTING COMMITS below).
-p, --preserve-merges
    Instead of ignoring merges, try to recreate them.

    This uses the --interactive machinery internally, but combining it with the --interactive option
    explicitly is generally not a good idea unless you know what you are doing (see BUGS below).
--autosquash, --no-autosquash
    When the commit log message begins with "squash! ..." (or "fixup! ..."), and there is a commit whose
    title begins with the same ..., automatically modify the todo list of rebase -i so that the commit
    marked for squashing comes right after the commit to be modified, and change the action of the moved
    commit from pick to squash (or fixup).

    This option is only valid when the --interactive option is used.

    If the --autosquash option is enabled by default using the configuration variable rebase.autosquash,
    this option can be used to override and disable this setting.
source manpages: git-rebase