/merge

Creates a GitLab merge request from the current branch into a target branch and merges it.

Usage

/merge [target-branch]

Parameters

Parameter Required Description
Target branch No Branch to merge into. Defaults to staging

What It Does

  1. Determines source branch from the current git branch
  2. Checks the remote is up to date — stops if there are unpushed commits (use /rollout first)
  3. Ensures the target branch exists on the remote — creates it if needed
  4. Creates the merge request via glab mr create
  5. Merges the MR automatically via glab mr merge
  6. Reports the result — shows the merged MR URL on success

Merge Conflicts

If the merge fails due to conflicts, the command informs you and provides the MR URL for manual resolution. It does not attempt to resolve conflicts automatically.

Examples

/merge              # Merge current branch → staging
/merge staging      # Same as above
/merge main         # Merge current branch → main (production)

Prerequisites

  • glab must be authenticated
  • All changes must be pushed (use /rollout first)
  • You must not be on main or production — those cannot be used as source branches