/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
- Determines source branch from the current git branch
- Checks the remote is up to date — stops if there are unpushed commits (use /rollout first)
- Ensures the target branch exists on the remote — creates it if needed
- Creates the merge request via
glab mr create - Merges the MR automatically via
glab mr merge - 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
glabmust be authenticated- All changes must be pushed (use
/rolloutfirst) - You must not be on
mainorproduction— those cannot be used as source branches