#!/usr/bin/env bash

set -euo pipefail

merge_commit=$1
shift

for parent in {1..1000}; do
  git checkout "${merge_commit}^${parent}"
  git merge --no-edit "${merge_commit}^1"

  "$@"
done
