run fetch before push operations#75
Open
skarim wants to merge 3 commits intoskarim/unstack-cleanupfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a branch-scoped fetch helper to the git layer and wires it into stack push flows so branch refs are refreshed immediately before pushing. It touches the CLI commands that publish stack branches (push, submit, and link) plus their test coverage.
Changes:
- Add
FetchBranches(remote, branches)to the git ops interface, default implementation, wrapper, and test mock. - Run the new fetch step before push operations in
submit,push, andlink. - Add tests for fetch-before-push ordering, and update
pushexpectations around atomic push behavior.
Show a summary per file
| File | Description |
|---|---|
internal/git/mock_ops.go |
Extends the git mock with a branch-scoped fetch hook for tests. |
internal/git/gitops.go |
Adds the concrete FetchBranches implementation to the git ops layer. |
internal/git/git.go |
Exposes the new fetch helper through the package-level API. |
cmd/submit.go |
Fetches active remote branches before sequential submit pushes. |
cmd/submit_test.go |
Verifies submit performs fetch before pushing stack branches. |
cmd/push.go |
Fetches active branches before push and changes push atomicity. |
cmd/push_test.go |
Adds fetch-before-push coverage and updates push behavior assertions. |
cmd/link.go |
Fetches candidate branches before pushing them during link. |
cmd/link_test.go |
Verifies link performs fetch before push. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 3
Comment on lines
+114
to
+116
| args := []string{"fetch", remote} | ||
| args = append(args, branches...) | ||
| return runSilent(args...) |
skarim
commented
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a targeted
git fetchof active stack branches before everygit pushcall. This fixes--force-with-leaserejections for users with shallow clones, where remote tracking refs may be stale or missing.Changes
Stack created with GitHub Stacks CLI • Give Feedback 💬