Implement ghstack pull#354
Open
ezyang wants to merge 1 commit into
Open
Conversation
Implement `ghstack pull` as a new subcommand that pulls remote updates for a ghstack PR into the local working tree. The command resolves the PR from HEAD's commit message or an explicit PR argument, fetches the remote head/orig refs, and merges remote changes with local changes. Key behaviors: - Fast-forward: if the local commit is an ancestor of the remote orig, simply check out the remote orig directly. - Clean merge: use `git merge-tree --write-tree` to produce a merged tree without touching the worktree, then create a new orig commit with the merged tree and updated ghstack-source-id. - Conflict: fall back to `git merge-recursive` to materialize conflicts in the worktree, save state to `.git/GHSTACK_PULL`, and instruct the user to resolve and run `ghstack pull --continue`. - Continue: `--continue` validates that conflicts are resolved and all changes are staged, then writes the merged tree and checks out the result. The merge strategy works by finding the remote head commit whose tree matches the local ghstack-source-id (establishing the common ancestor), creating an imputed head commit from the local tree, and merging that against the remote head. Includes three test scenarios: basic non-conflicting pull, conflicting pull with manual resolution via --continue, and explicit PR argument with fast-forward. [ghstack-poisoned]
Owner
Author
|
Stack from ghstack (oldest at bottom): |
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.
No description provided.