When we run a build in Jenkins, the cloned repository has additional branches for pull-requests associated to commits. In Jenkins we are seeing branches such as origin/pull-requests/23/from.
When we clone the same repository to a developer workstation, the pull-requests branches do NOT appear. For example "git branch --remotes" does NOT show any origin/pull-requests/* branches. However, in Jenkins, the same command will show several origin/pull-requests/* branches.
These origin/pull-requests/* branches are causing issues in Jenkins because the Git plugin is setting GIT_BRANCH to pull-requests/... which is causing a few downstream issues for scripts that expect GIT_BRANCH to be the actual branch within the git repository.
With all that as background, how can we prevent Jenkins from seeing these origin/pull-requests/* branches?