Skip to content

fix: remove overly cautious divergence check and fix stale info push errors#33

Merged
javoire merged 1 commit intomainfrom
fix/divergence-and-stale-info
Dec 8, 2025
Merged

fix: remove overly cautious divergence check and fix stale info push errors#33
javoire merged 1 commit intomainfrom
fix/divergence-and-stale-info

Conversation

@javoire
Copy link
Copy Markdown
Owner

@javoire javoire commented Dec 8, 2025

Problem

stack sync was erroring with "local and remote have diverged" in cases where divergence is expected and normal - specifically after rebasing onto an updated parent branch. This is the standard workflow for stacked branches.

Additionally, --force-with-lease could fail with "stale info" errors even after fetching, due to git reflog inconsistencies.

Solution

  1. Remove the divergence error - Instead of erroring when local and remote have diverged, just log it in verbose mode and continue. This is expected after rebasing onto an updated parent. The --force-with-lease push provides sufficient safety.

  2. Use explicit --force-with-lease syntax - Changed from plain --force-with-lease to --force-with-lease=refs/heads/<branch>:<expected-sha>. This explicitly tells git what SHA we expect the remote to be, avoiding "stale info" errors that can occur when relying on implicit tracking state.

  3. Update --force flag description - Since it's no longer needed for the divergence case, updated the description to reflect its actual purpose: bypassing --force-with-lease safety entirely.

@javoire javoire force-pushed the fix/divergence-and-stale-info branch 2 times, most recently from 679a20d to a7dd2cb Compare December 8, 2025 18:35
@javoire javoire force-pushed the fix/divergence-and-stale-info branch from a7dd2cb to e4e128d Compare December 8, 2025 18:37
@javoire javoire merged commit 57ba5e6 into main Dec 8, 2025
1 check passed
@javoire javoire deleted the fix/divergence-and-stale-info branch December 8, 2025 21:29
@javoire
Copy link
Copy Markdown
Owner Author

javoire commented Dec 8, 2025

🎉 This PR is included in version 1.3.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant