From 779094f6aa63d670b598f74bc303ca5c79e1acb3 Mon Sep 17 00:00:00 2001 From: Bart Thomee <11445373+bthomee@users.noreply.github.com> Date: Tue, 14 Oct 2025 14:14:21 -0400 Subject: [PATCH] chore: Add script to squash commits in PRs ready to merge --- bin/git/squash-commits.sh | 114 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 bin/git/squash-commits.sh diff --git a/bin/git/squash-commits.sh b/bin/git/squash-commits.sh new file mode 100644 index 0000000000..32d9ead20b --- /dev/null +++ b/bin/git/squash-commits.sh @@ -0,0 +1,114 @@ +#!/bin/bash + +if [[ $# -ne 3 || "$1" == "--help" || "$1" = "-h" ]] +then + name=$( basename $0 ) + cat <<- USAGE + Usage: $name pr "title" "description" + + * All commits in the specified PR will be squashed and a new commit prepared + with the provided title and description as commit message. + * This script will not push the new commit. You will need to do so yourself + by force-pushing, since you will be rewriting history. You must be the + author of the PR or a maintainer of the repository in order to perform this + operation. + * The 'gh' CLI tool must be installed and authenticated. + * To write a multiline description, you can use "\$(cat <