rebase -i -p: refactor the preparation for -p into its own function