gitbutler icon indicating copy to clipboard operation
gitbutler copied to clipboard

Create stacked PR on top of remote PR

Open mgood opened this issue 8 months ago • 1 comments

Version

0.14.18

Operating System

macOS

Distribution Method

dmg (Mac OS - Apple Silicon)

Describe the issue

I get errors if I try to create a stacked PR on top of a co-worker's PR I've pulled into my workspace.

How to reproduce (Optional)

  1. Go to PRs list
  2. Select remote PR & click Apply
  3. Add a Dependent Branch
  4. Make a new commit with my local changes
  5. Click Create Pull Request

Expected behavior (Optional)

At step 2 when the PR branch is applied to my workspace it gets a new hash, and shows that I should "Force Push" the branch. When I try to create a PR for my commit it attempts to force-push to the other user's PR branch to the new commit created locally by GitButler. Is there a way to avoid this force-push? Their remote PR contains a single commit on top of the upstream main branch. However, when trying to push my own branch, GitButler also attempts to push to their branch, which is rejected.

Relevant log output (Optional)

git command exited with non-zero exit code 1: ["push", "--quiet", "--no-verify", "upstream", "asdfasdf:refs/heads/remote-branch-name"] STDOUT: STDERR: To https://github.com/org/repo.git ! [rejected] asdfasdf -> remote-branch-name (non-fast-forward) error: failed to push some refs to 'https://github.com/org/repo.git' hint: Updates were rejected because a pushed branch tip is behind its remote hint: counterpart. If you want to integrate the remote changes, use 'git pull' hint: before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

mgood avatar Apr 16 '25 19:04 mgood

Thanks a lot for reporting!

It seems like difficulties to correctly classify commits and/or understand the commit-graph. I'd hope that in the next major release, this would (eventually) be fixed, even though no work was done in that direction yet.

Byron avatar Apr 17 '25 13:04 Byron