• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

      I checkout origin/myBranch. Because last commit is also on master branch the GIT_BRANCH is set to master.

      Similar issue when I use "merge before use" option and set "branch to merge to" GIT_BRANCH is set to latest commit(in this case origin/master) not the checkouted branch.

          [JENKINS-21536] GIT_BRANCH should not change after merge

          I just hit the same issue with feature branch builds that merge the integration branch before the build.

          Achim Staebler added a comment - I just hit the same issue with feature branch builds that merge the integration branch before the build.

          Ingo Mohr added a comment -

          Same problem here. We locally merge a feature branch (or bugfix branch) to master in order to check whether the branch can be merged later with a pull request. And for this, we need the "actual" feature branch name. But on Jenkins, the name of the $GIT_BRANCH is always "master" once we've locally merged.
          Maybe, an all-new variable should be added since the GIT_BRANCH name actually is "master. It's just: we need the name of the branch merged before building.

          Ingo Mohr added a comment - Same problem here. We locally merge a feature branch (or bugfix branch) to master in order to check whether the branch can be merged later with a pull request. And for this, we need the "actual" feature branch name. But on Jenkins, the name of the $GIT_BRANCH is always "master" once we've locally merged. Maybe, an all-new variable should be added since the GIT_BRANCH name actually is "master. It's just: we need the name of the branch merged before building.

            Unassigned Unassigned
            fugi Milosz Sotomski
            Votes:
            5 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: