From 58b5eb6e18d59e1b543578125b4d3cac99ff545c Mon Sep 17 00:00:00 2001 From: Darren Cheng Date: Sun, 15 Mar 2026 12:53:19 -0700 Subject: [PATCH] Fetch before commit count check in merge script Extract do_fetch() from do_rebase() and call it before check_commits() so the commit count is computed against fresh origin/master rather than a stale local ref. This prevents pushing stale commits and surfacing rebase conflicts late in the merge flow. Co-Authored-By: Claude Opus 4.6 (1M context) --- agents/skills/merge/scripts/merge.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/agents/skills/merge/scripts/merge.sh b/agents/skills/merge/scripts/merge.sh index 44aba68c..17956f7d 100755 --- a/agents/skills/merge/scripts/merge.sh +++ b/agents/skills/merge/scripts/merge.sh @@ -66,10 +66,12 @@ check_commits() { info "Commits to merge: $count" } -do_rebase() { +do_fetch() { info "Fetching ${TARGET}..." git fetch "$TARGET" +} +do_rebase() { info "Rebasing onto ${TARGET}/master..." if ! git rebase "${TARGET}/master"; then echo "REBASE_CONFLICT" >&2 @@ -240,6 +242,7 @@ ${COAUTHOR}" determine_target get_branch + do_fetch check_commits if [[ "$skip_rebase" == false ]]; then