From 5484a726f754a4c4f30a3cf34438912050ba644b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Rubinstein?= Date: Tue, 2 Jun 2026 10:08:18 +0200 Subject: [PATCH 1/3] Explain the commit hash in the conflict-resolution comment The resolution steps told the user to `git merge <40-char hash>` with no hint of what that commit is. Gloss it inline as the target branch as it was just before the merged branch landed. Also drops the redundant "I tried to merge ..." header sentence and its only helper, format_branch_list_for_text: the merge commands now carry that information. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test_e2e.sh | 2 +- update-pr-stack.sh | 17 +---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/tests/test_e2e.sh b/tests/test_e2e.sh index b510424..1da4439 100755 --- a/tests/test_e2e.sh +++ b/tests/test_e2e.sh @@ -291,7 +291,7 @@ assert_conflict_comment_merges() { expected+="git merge $conflict"$'\n' done expected=${expected%$'\n'} - actual=$(echo "$comment" | grep -E '^git merge' || true) + actual=$(echo "$comment" | grep -E '^git merge' | sed 's/ *#.*//' || true) if [[ "$actual" == "$expected" ]]; then echo >&2 "✅ Verification Passed: conflict comment lists expected merge command(s)." diff --git a/update-pr-stack.sh b/update-pr-stack.sh index 3676a9e..cdd6cec 100755 --- a/update-pr-stack.sh +++ b/update-pr-stack.sh @@ -74,17 +74,6 @@ has_squash_commit() { && git merge-base --is-ancestor SQUASH_COMMIT "$BRANCH" } -format_branch_list_for_text() { - for ((i=1; i<=$#; i++)); do - case $i in - 1) format='`%s`';; - $#) format=', and `%s`';; - *) format=', `%s`';; - esac - printf "$format" "${!i}" - done -} - update_direct_target() { local BRANCH="$1" local BASE_BRANCH="$2" @@ -113,7 +102,7 @@ update_direct_target() { # included in the merged branch — otherwise the first merge covers it. if ! git merge-base --is-ancestor SQUASH_COMMIT~ "origin/$MERGED_BRANCH"; then if ! log_cmd git merge --no-edit SQUASH_COMMIT~; then - CONFLICTS+=( "$(git rev-parse SQUASH_COMMIT~)" ) + CONFLICTS+=( "$(git rev-parse SQUASH_COMMIT~) # $TARGET_BRANCH just before $MERGED_BRANCH was merged" ) log_cmd git merge --abort fi fi @@ -135,10 +124,6 @@ update_direct_target() { { echo "### ⚠️ Automatic update blocked by merge conflicts" echo - echo -n "I tried to merge " - format_branch_list_for_text "${CONFLICTS[@]}" - echo " into this branch while updating the pull request stack and hit conflicts." - echo echo "#### How to resolve" echo '```bash' echo "git fetch origin" From 26b35db71ee7718d44217eb5e9d664b820ed4667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Rubinstein?= Date: Tue, 2 Jun 2026 10:09:46 +0200 Subject: [PATCH 2/3] Replace the dangling sub-header with a lead-in line Dropping the intro paragraph had left two headers back to back. The warning header now leads straight into a one-line lead-in and the steps. Co-Authored-By: Claude Opus 4.8 (1M context) --- update-pr-stack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update-pr-stack.sh b/update-pr-stack.sh index cdd6cec..e951c92 100755 --- a/update-pr-stack.sh +++ b/update-pr-stack.sh @@ -124,7 +124,7 @@ update_direct_target() { { echo "### ⚠️ Automatic update blocked by merge conflicts" echo - echo "#### How to resolve" + echo "Resolve them like this:" echo '```bash' echo "git fetch origin" echo "git switch $BRANCH" From f8cc143fe694055f463e00b1da0c971c5f9818d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Rubinstein?= Date: Tue, 2 Jun 2026 10:16:45 +0200 Subject: [PATCH 3/3] Fast-forward locally instead of re-fetching the branch The resolution steps ran `git fetch origin` and then `git pull origin `, which fetches the branch a second time. The standalone fetch already has every ref the later merges need, so update the local branch with a local fast-forward to the fetched tip. Co-Authored-By: Claude Opus 4.8 (1M context) --- update-pr-stack.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update-pr-stack.sh b/update-pr-stack.sh index e951c92..a2d8ca5 100755 --- a/update-pr-stack.sh +++ b/update-pr-stack.sh @@ -128,7 +128,7 @@ update_direct_target() { echo '```bash' echo "git fetch origin" echo "git switch $BRANCH" - echo "git pull origin $BRANCH" + echo "git merge --ff-only origin/$BRANCH" for i in "${!CONFLICTS[@]}"; do echo "git merge ${CONFLICTS[$i]}"