Task 2: Merging a branch - ArzArcanum/tech504 GitHub Wiki

Merging a branch

You can configure a Jenkins project to automatically merge a branch when built.

  • Create a new freestyle project, and go to the configuration page.
  • check GitHub project
    • Project URL: Github repo URL
  • Under Source Code Management, check Git
    • Repository URL: provide the SSH remote for your Git repo (remove .git from the end)

      GitHub SSH link

    • Credentials → Add → Jenkins

    • Select your Credentials from the drop-down box.

    • Branches to build → Add branch → */your-branch-name

    • Repository browser: (auto)

  • Under Build Triggers, check Build after other projects are built.
    • Provide the name of the project to watch.
    • Check Trigger only if build is stable.
  • Post-build Actions → Add post-build action → Git Publisher
    • Check Push Only If Build Succeeds
    • Check Merge Results
    • Click Add branch
      • Branch to push: (any)
      • Target remote name: origin
  • Save changes.