Skip to content

gh merge pr -s -d does not delete PR branch if on a fork different from base branch #2860

@VRanga000

Description

@VRanga000

Describe the bug

 ❯ gh --version
gh version 1.5.0 (2021-01-21)
https://github.com/cli/cli/releases/tag/v1.5.0

When merging a PR from a branch on a different fork (than the base branch) with squash and delete enabled via the gh cli causes the PR to be merged with a squashed commit, but the source branch is not deleted either locally or remotely.

Steps to reproduce the behavior

  1. Create a PR from a branch on a fork different from the base branch.
  2. Merge the PR via the cli with squash and delete-branch enabled: gh merge pr -s -d xx
  3. The PR should get merged and the source branch deleted locally and remotely.

Expected vs actual behavior

Expected result:
The PR should get merged and the source branch deleted locally and remotely.

Actual result:
The PR gets merged but the source branch are not deleted locally or remotely.

Logs

 ❯ gh pr merge -s -d 50
✔ Squashed and merged pull request #50 (Various updates)
 ❯ gbd feature/updates                                                                                                                 
warning: deleting branch 'feature/updates' that has been merged to
         'refs/remotes/origin/feature/updates', but not yet merged to HEAD.
Deleted branch feature/updates (was 0d02dc6).
 ❯ gp origin :feature/updates                                                                                                          To github.comcast.com:VRanga000/pulumi.git
 - [deleted]         feature/updates

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-prrelating to the gh pr commandpriority-3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions