Create a GitLab merge request for the current branch. Follow these steps:
- •
Get Current Branch: Run
git branch --show-currentto get the current branch name. - •
Check for Existing MR: Use
get_merge_requestwith the source branch to check if an MR already exists. If it does, report the existing MR URL and ask if the user wants to update it. - •
Determine Target Branch:
- •If $ARGUMENTS specifies a target branch, use that
- •Otherwise, default to the repository's main branch (usually
mainordev)
- •
Gather Commit Information: Use
list_commitsto get the commits on this branch that will be included in the MR. - •
Get Diff Summary: Use
get_branch_diffsto understand the scope of changes. - •
Prepare MR Details:
- •Title: Generate from the branch name or first commit message
- •Description: Create a summary including:
- •Overview of changes
- •List of key commits
- •Any relevant context
- •
Create the MR: Use
create_merge_requestwith:- •
source_branch: Current branch - •
target_branch: From step 3 - •
title: Concise, descriptive title - •
description: Formatted description with summary
- •
- •
Report Success: Display the MR URL and key details.
Description Format
markdown
## Summary [Brief description of changes] ## Changes - [Key change 1] - [Key change 2] ## Test plan - [ ] [Testing step 1] - [ ] [Testing step 2]
Guidelines
- •Keep titles under 72 characters
- •Use imperative mood in titles ("Add feature" not "Added feature")
- •Include relevant ticket references if branch name contains them (e.g., PROJ-123)
- •Don't mark as draft unless explicitly requested