rebase -i: move the code to write the rebase script into generate_script()