Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-10997

Close branch on PR merge from fork does not close branch in source repository (BB-12657)

      I forked from a repository, and then from the forked repository I created a branch called second, and did a Pull Request to merge with the original repository. Before merging, I checked on the line that says "close second after pull request is merged".

      But after I merged with the original repository, the branch second is still not being deleted from the forked repository:


      Edit by @tboudale : The destination branch may get deleted by this bug in the following scenario:

      1. Create a repo1 with branch develop. develop must not be the main branch.
      2. Create a fork of repo2.
      3. Create a PR from repo2/develop into repo1/develop.
      4. Merge the PR while also selecting "Close Source Branch"
      5. (BUG) The repo1/develop branch is deleted.

        1. 2070891136-pullrequest2.JPG
          2070891136-pullrequest2.JPG
          65 kB
        2. 2324859914-pullrequest1.JPG
          2324859914-pullrequest1.JPG
          93 kB
        3. 3666533747-pullrequest3.JPG
          3666533747-pullrequest3.JPG
          60 kB

            [BCLOUD-10997] Close branch on PR merge from fork does not close branch in source repository (BB-12657)

            Attachment 3666533747-pullrequest3.JPG has been added with description: Originally embedded in Bitbucket issue #10997 in site/master

            Gideon Koh (Inactive) added a comment - Attachment 3666533747-pullrequest3.JPG has been added with description: Originally embedded in Bitbucket issue #10997 in site/master

            Attachment 2070891136-pullrequest2.JPG has been added with description: Originally embedded in Bitbucket issue #10997 in site/master

            Gideon Koh (Inactive) added a comment - Attachment 2070891136-pullrequest2.JPG has been added with description: Originally embedded in Bitbucket issue #10997 in site/master

            Attachment 2324859914-pullrequest1.JPG has been added with description: Originally embedded in Bitbucket issue #10997 in site/master

            Gideon Koh (Inactive) added a comment - Attachment 2324859914-pullrequest1.JPG has been added with description: Originally embedded in Bitbucket issue #10997 in site/master

            A fix for this issue was just deployed to Bitbucket production.

            Abhin Chhabra (Inactive) added a comment - A fix for this issue was just deployed to Bitbucket production.

            I have an update: a PR to fix this has been approved and merged into a staging environment. The fix should go out into production in the coming days (most likely tomorrow). I'll update this ticket when the fix is out.

            Abhin Chhabra (Inactive) added a comment - I have an update: a PR to fix this has been approved and merged into a staging environment. The fix should go out into production in the coming days (most likely tomorrow). I'll update this ticket when the fix is out.

            I've begun work on fixing this issue. I think the checkbox should continue to exist and it should trigger the deletion of the branch in the forked repository.

            I have written up some tests that illustrate the problem and I'll be working on the fix now. I'll post again when I have an update.

            Abhin Chhabra (Inactive) added a comment - I've begun work on fixing this issue. I think the checkbox should continue to exist and it should trigger the deletion of the branch in the forked repository. I have written up some tests that illustrate the problem and I'll be working on the fix now. I'll post again when I have an update.

            In my workflow (all devs fork from main repository and do pull requests from their own branches), I was expecting the checkbox to work and have the branches from my forked repo closed after merge. But today I have to delete the branch from my local repo (normal), then go to Bitbucket branches list, delete the branch, and 'git remote prune origin' (not normal).

            Any way to make it work?

            Karine Delvare added a comment - In my workflow (all devs fork from main repository and do pull requests from their own branches), I was expecting the checkbox to work and have the branches from my forked repo closed after merge. But today I have to delete the branch from my local repo (normal), then go to Bitbucket branches list, delete the branch, and 'git remote prune origin' (not normal). Any way to make it work?

            brocoli added a comment -

            I guess this issue is a huge misunderstanding.

            The checkbox is deleting the branch for me, but only in the original repository, not in the forked one. (Maybe the text should read "close remote/branch after the pull request is merged".)

            It would be good if there was another checkbox to delete the branch in the forked repository automatically after the pull request is accepted.

            brocoli added a comment - I guess this issue is a huge misunderstanding. The checkbox is deleting the branch for me, but only in the original repository, not in the forked one. (Maybe the text should read "close remote/branch after the pull request is merged".) It would be good if there was another checkbox to delete the branch in the forked repository automatically after the pull request is accepted.

            Is this fix on the roadmap?
            Or at least removing the checkbox from the UI?

            Wynn Slater added a comment - Is this fix on the roadmap? Or at least removing the checkbox from the UI?

            LukasM added a comment -

            Extremely annoying issue, can't believe it is still not fixed.

            LukasM added a comment - Extremely annoying issue, can't believe it is still not fixed.

              achhabra@atlassian.com Abhin Chhabra (Inactive)
              gkoh Gideon Koh (Inactive)
              Affected customers:
              6 This affects my team
              Watchers:
              15 Start watching this issue

                Created:
                Updated:
                Resolved: