diff --git a/dev/merge_spark_pr.py b/dev/merge_spark_pr.py index 291f09d2635e5..7d5c646823f52 100755 --- a/dev/merge_spark_pr.py +++ b/dev/merge_spark_pr.py @@ -677,12 +677,33 @@ def _do_cherry_pick(pr_num, merge_hash, pick_ref): run_cmd("git checkout %s" % pick_branch_name) try: - run_cmd("git cherry-pick -sx %s" % merge_hash) + run_cmd( + [ + "git", + "-c", + "commit.cleanup=scissors", + "cherry-pick", + "-sx", + merge_hash, + ] + ) except Exception as e: msg = "Error cherry-picking: %s\nWould you like to manually fix-up this merge?" % e continue_maybe(msg, True) - msg = "Okay, please fix any conflicts and finish the cherry-pick. Finished?" + msg = "Okay, please fix any conflicts and 'git add' conflicting files... Finished?" continue_maybe(msg, True) + # Important to use `scissors` and `--edit` otherwise git will strip lines starting with `#` + # when calling `--continue`. See: https://github.com/apache/spark/pull/58214 + run_cmd( + [ + "git", + "-c", + "commit.cleanup=scissors", + "cherry-pick", + "--continue", + "--edit", + ] + ) continue_maybe( "Pick complete (local ref %s). Push to %s?" % (pick_branch_name, PUSH_REMOTE_NAME)