Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-3083

Help in Pull Request promote wrong solution to merge with conflicts

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 2.1.3
    • None
    • Help, Pull Requests
    • None

      If pull request can't be merged, Stash show instructions how to solve this and this instructions are wrong:

      Merge conflict
      This merge has conflicts. You must resolve the conflicts before merging the pull request:
      Step 1: Fetch the changes and checkout the destination branch.

      git fetch 
      git checkout master
      

      Step 2: Merge the source branch and resolve conflicts as appropriate.

      git merge -m "Merge pull request #4 from feature-branch to master" --log --no-ff feature-branch
      

      Step 3: After the merge conflicts are resolved, commit the changes and push.

      git commit 
      git push origin HEAD
      

      First off all. You must merge master into feature-branch, but not a feature-branch to master. You should make Pull Request is valid to merge via button in web interface. Not a merge with bypass it.

      The permissions to push changes into master is only on some lead developers. If all start to resolve conflict, this make them very unhapy. Only author of feature-branch must merge conflicts, but author has no access to push into master.

      You should done resolve conflicts by this commands:

      git fetch
      git checkout feature-branch
      git merge --no-ff master
      git push origin feature-branch
      

      This make opened Pull Request available to merge from web interface.

            [BSERV-3083] Help in Pull Request promote wrong solution to merge with conflicts

            Owen made changes -
            Workflow Original: Stash Workflow - Restricted [ 1447855 ] New: JAC Bug Workflow v3 [ 3136578 ]

            The instructions are still wrong. Now instruction is like this:

            git checkout master
            git pull origin branch_name

            git commit
            git push origin HEAD

            Nadezhda Rivkind added a comment - The instructions are still wrong. Now instruction is like this: git checkout master git pull origin branch_name git commit git push origin HEAD
            Owen made changes -
            Workflow Original: Stash Workflow [ 462005 ] New: Stash Workflow - Restricted [ 1447855 ]

            Totally. I opened STASH-5443.

            Nick Upton added a comment - Totally. I opened STASH-5443 .

            The instructions are wrong. When resolving a conflict the branches are in the instructions are reversed. Fix it!

            Rob Anderson added a comment - The instructions are wrong. When resolving a conflict the branches are in the instructions are reversed. Fix it!

            Nick Upton added a comment -

            I don't understand how this was fixed. In Stash 3.3.1:

            I create a pull request from release/1.0 -> feature/develop/1.1 to pick up bugfixes that have been committed to the release branch only. When conflicts arise, I am still seeing instructions like this:

            This pull request has conflicts. You must resolve the conflicts before you can merge:
            Step 1: Fetch the changes (saving the target branch as FETCH_HEAD).

            git fetch origin feature/develop/1.1
            

            Step 2: Checkout the source branch and merge in the changes from the target branch. Resolve conflicts.

            git checkout release/1.0 
            git merge FETCH_HEAD
            

            Step 3: After the merge conflicts are resolved, stage the changes accordingly, commit the changes and push.

            git commit
            git push origin HEAD
            

            Step 4: Merge the updated pull request.

            These instructions seem to encourage a merge from feature/develop/1.1 -> release/1.0 which is definitely not the behavior I want. I am trying to bring back bugfixes, not bring my 1.1 code into the 1.0 release branch.

            Isn't Alexey's solution in the original bug description (without push -f) the correct behavior?

            git fetch
            git checkout feature-branch
            git merge --no-ff master
            git push origin feature-branch

            This properly merges the source into target, instead of target into source as the Stash instructions recommend.

            Nick Upton added a comment - I don't understand how this was fixed. In Stash 3.3.1: I create a pull request from release/1.0 -> feature/develop/1.1 to pick up bugfixes that have been committed to the release branch only. When conflicts arise, I am still seeing instructions like this: This pull request has conflicts. You must resolve the conflicts before you can merge: Step 1: Fetch the changes (saving the target branch as FETCH_HEAD). git fetch origin feature/develop/1.1 Step 2: Checkout the source branch and merge in the changes from the target branch. Resolve conflicts. git checkout release/1.0 git merge FETCH_HEAD Step 3: After the merge conflicts are resolved, stage the changes accordingly, commit the changes and push. git commit git push origin HEAD Step 4: Merge the updated pull request. These instructions seem to encourage a merge from feature/develop/1.1 -> release/1.0 which is definitely not the behavior I want. I am trying to bring back bugfixes, not bring my 1.1 code into the 1.0 release branch. Isn't Alexey's solution in the original bug description (without push -f) the correct behavior? git fetch git checkout feature-branch git merge --no-ff master git push origin feature-branch This properly merges the source into target, instead of target into source as the Stash instructions recommend.
            Kostya Marchenko (Inactive) made changes -
            Component/s New: Application Help [ 25322 ]
            Seb Ruiz (Inactive) made changes -
            Link New: This issue is related to STASHDEV-3563 [ STASHDEV-3563 ]

            The push -f is destructive if branch 'feature' is being developed by several users. If by single one, it not destructive. But you are right, in common sense it is destructive.

            Pluggable instruction will be nice in fact.

            Alexey Efimov added a comment - The push -f is destructive if branch 'feature' is being developed by several users. If by single one, it not destructive. But you are right, in common sense it is destructive. Pluggable instruction will be nice in fact.

            Alexey,
            We appreciate your input here.

            You should never-never-ever merge main-master branch into feature branch to resolve conflict, because then you start to rebase with pull request into other 'stable' masters, you get Hell Of Conflicts Waterfall.
            The better and universal way to resolve conflicts is using rebase and push -f. Or using squash merge commits. First one is better, that merge with squash.

            I don't believe that Stash will ever promote anything but the very simplest solutions out of the box, and certainly not advocate push -f as this can be a very destructive operation if the git users are not very educated in what they are doing.

            We may consider making these instructions pluggable at some point in the future, if there is enough demand for it.

            Seb Ruiz (Inactive) added a comment - Alexey, We appreciate your input here. You should never-never-ever merge main-master branch into feature branch to resolve conflict, because then you start to rebase with pull request into other 'stable' masters, you get Hell Of Conflicts Waterfall. The better and universal way to resolve conflicts is using rebase and push -f. Or using squash merge commits. First one is better, that merge with squash. I don't believe that Stash will ever promote anything but the very simplest solutions out of the box, and certainly not advocate push -f as this can be a very destructive operation if the git users are not very educated in what they are doing. We may consider making these instructions pluggable at some point in the future, if there is enough demand for it.

              mstudman Michael Studman (Inactive)
              3652ed9ede2e Alexey Efimov
              Affected customers:
              1 This affects my team
              Watchers:
              15 Start watching this issue

                Created:
                Updated:
                Resolved: