In Jenkins how to merge two git branches as provided in the field:
branch_names to build: branch_name1, branch_name2
image added
and (if there was not conflict) then build the merged branch
I tried multibranch deployement but it does not meet my expectated usecase
CodePudding user response:
Checkout the branch you want to merge into:
git checkout <branch_to_merge_into>
Merge the other branch into the current branch:
git merge <other_branch>
Resolve any conflicts that may arise during the merge process. Commit the merge:
git commit
Once the merge is complete, build the branch using your preferred build method.
Push the merged branch to the remote repository:
git push origin <branch_to_merge_into>
CodePudding user response:
Use Jenkins Plugins- git and merge and create job as parameterized job(Two parameters)
Create two string values one with Source and Destination to pass it from parameters
Configure SCM git plugin with required credentials and add Branches to build section as shown (pass values as per parameter key values)
Use post Build option
Above configurations works for me.
ref: https://plugins.jenkins.io/git/#plugin-content-publisher-push-merge-results