You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh stack sync can fail force-with-lease push after fetching stack branches #118
gh stack sync can fetch and rebase a stack successfully, then fail during the final force push because the push uses a bare --force-with-lease with branch names instead of explicit destination refs and lease SHAs.
This is most visible in checkouts where local branch upstream/tracking configuration is missing, stale, or does not line up with the branches that gh stack sync just fetched.
The failure happens at the final git push. Git has to infer both the destination branch and the expected lease value from local branch configuration / remote-tracking refs. If that inference does not match the refs that gh stack sync just fetched, the push can be rejected even though the command already refreshed the relevant stack branch.
Expected Behavior
After gh stack sync fetches stack branches, the subsequent force push should use the fetched local tracking refs as the lease source.
If someone updates b1 after the fetch, the push should still fail safely because refs/heads/b1 no longer equals <fetched-sha>.
If b1 did not have a local tracking ref, the lease should use an empty expected value, so creating the remote branch still fails if someone created it first.
Activity
Fix force-with-lease push for branches without tracking refs
Fix force-with-lease push for branches without tracking refs (github#124