feat(stack): add --skip-push for local stack synchronization
Summary
Add --skip-push to glab stack sync. This enables developers to perform local stack synchronization and rebase propagation across dependent Git branches without pushing intermediate changes to the remote repository or triggering unnecessary remote CI/CD pipelines.
Problem
During local development in a stacked diff workflow, amending or updating a lower branch requires running glab stack sync to propagate rebases down the stack. Currently, this forces an immediate remote push (git push --force-with-lease), which can trigger unwanted remote CI/CD pipelines during early local iteration. Without a way to skip the push, developers must either trigger those remote workflows or manually reproduce parts of the synchronization process locally, adding unnecessary context-switching overhead.
Solution
- Add the
--skip-pushflag toglab stack sync. - Preserve the existing fetch and rebase behavior.
- Allow local cascading/rebase propagation across downstream stack branches.
- Skip the final remote push when
--skip-pushis enabled. - Prevent MR creation for branches that do not already have an MR when push is skipped.
- Add test coverage for the new flag and skip-push synchronization behavior.
Test
Added unit test scenarios in stack_sync_test.go:
- Flag registration & default state verification: Asserts
--skip-pushflag is correctly registered onglab stack syncand defaults tofalse. - Local rebase propagation: Verifies that a diverged stack is rebased across downstream branches without invoking
forcePushAllWithLeasewhen--skip-pushis enabled. - MR creation suppression: Verifies that branches without an existing MR do not trigger MR creation when
--skip-pushis enabled.
Related Issues
Resolves #8554 (closed)