Skip to content

derp#4

Closed
boneskull wants to merge 2 commits into
mainfrom
derp
Closed

derp#4
boneskull wants to merge 2 commits into
mainfrom
derp

Conversation

@boneskull
Copy link
Copy Markdown
Owner

No description provided.

Documents the approved design for automatically pushing branches
to remote before creating or updating PRs. This removes manual
push friction from the stacked PR workflow.
@boneskull
Copy link
Copy Markdown
Owner Author

boneskull commented Jan 28, 2026

Stack


Managed by gh-stack

Copilot AI review requested due to automatic review settings January 28, 2026 23:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a design document describing how gh stack pr should automatically push the current branch (with --force-with-lease and upstream tracking) before creating or updating a pull request.

Changes:

  • Introduces an auto-push flow for gh stack pr, including a new PushWithUpstream helper in internal/git/git.go.
  • Specifies when and how the push should be invoked in cmd/pr.go prior to PR creation/update.
  • Documents expected error-handling behavior and test strategy (unit and manual) for the new behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +56 to +63
Insert push call in `runPR()` after validating the branch is tracked (after line ~56), before checking if PR exists:

```go
// Push branch to remote (with tracking) before PR operation
fmt.Printf("Pushing %s to origin...\n", branch)
if err := g.PushWithUpstream(branch); err != nil {
return fmt.Errorf("failed to push branch: %w", err)
}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here the design says to insert the push call after validating that the branch is tracked, but the "Error Handling" section below describes the first push for an untracked branch succeeding because -u sets up tracking. These two statements conflict: if tracking validation still happens before PushWithUpstream, the first-push scenario would fail instead of succeeding, so either the validation step or the described behavior should be updated for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +74 to +80
| Scenario | Behavior |
|----------|----------|
| No network | Command fails with git's error message |
| Diverged history (remote has unseen commits) | Force-with-lease rejects push, command fails |
| No permission | Command fails with git's error message |
| Branch already up-to-date | Push succeeds quickly, continues to PR |
| First push (no tracking) | `-u` sets up tracking, succeeds |
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Markdown table in this section starts each row with a double pipe (||), which introduces an extra empty column and is likely to render incorrectly. This should be a standard two-column table with a single leading pipe so that "Scenario" and "Behavior" are the only columns.

Copilot uses AI. Check for mistakes.
This was referenced Jan 29, 2026
Closed
@boneskull boneskull closed this Jan 29, 2026
@boneskull boneskull deleted the derp branch January 29, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants