GitLab Merge Request Workflow
Instructions
1. Check Current State
Start by checking the repo state so you know what you're working with:
# Current branch and remote
git branch --show-current
git remote get-url origin
# Uncommitted changes
git status --short
# Existing MR for current branch
glab mr list --source-branch=$(git branch --show-current) 2>/dev/null || echo "No MR"
2. Validate Jira Ticket (Required for Commits)
Before committing, confirm a Jira ticket is in context:
- Look for
EPMCDME-xxxpattern in the conversation - Check if the user provided a ticket number
- If none found: ask — "What is the Jira ticket number (EPMCDME-xxx) for this commit?"
Don't commit without a ticket — it's required for traceability.
3. Handle Based on User Request
"commit changes" → Commit only:
git add .
git commit -m "EPMCDME-xxx: Action and message"
"push changes" → Push only:
git push --set-upstream origin $(git branch --show-current)
"create MR" → Full workflow (see step 4).
4. Create MR Workflow
If on main branch:
- Create a feature branch first:
git checkout -b <type>/<description> - Then commit, push, and open MR
If MR already exists:
git push --set-upstream origin $(git branch --show-current)
# Report: "Changes pushed to existing MR: <url>"
If no MR exists:
git push --set-upstream origin $(git branch --show-current)
glab mr create \
--title "EPMCDME-xxx: Brief description" \
--description "## Summary
[2-4 sentence overview]
## Changes
- [Key highlights only]
## Impact
[Optional: before/after for user-facing changes]
## Checklist
- [ ] Self-reviewed
- [ ] Manual testing performed
- [ ] Documentation updated (if needed)
- [ ] No breaking changes (or documented)"
Commit Format
Required Pattern: EPMCDME-xxx: Action and message
# Valid
git commit -m "EPMCDME-123: Add new documentation"
git commit -m "EPMCDME-456: Fix authentication bug"
git commit -m "EPMCDME-789: Refactor user service"
# Invalid
git commit -m "Add new feature" # Missing ticket
git commit -m "feat: add feature" # Wrong format
git commit -m "EPMCDME-123 add feature" # Missing colon
Branch Format
Pattern: <type>/<description> — Jira ticket is optional in the branch name
feat/add-user-profile
fix/auth-timeout
docs/api-guide
feat/EPMCDME-123-user-settings
MR Title Format
Pattern: EPMCDME-xxx: Brief description — always lead with the ticket number.
Troubleshooting
"glab: command not found"
brew install glab # macOS
snap install glab # Linux
No Jira ticket in context
Ask the user: "What is the Jira ticket number (EPMCDME-xxx) for this commit?"
Validate it matches EPMCDME-\d+ before proceeding.
Already on main branch
Create a feature branch before committing:
git checkout -b <type>/<short-description>
No changes to commit
Check git status — nothing staged or working tree is clean.
MR already exists
Push to the existing MR; don't create a new one.
Examples
User: "commit these auth changes for EPMCDME-456"
git add .
git commit -m "EPMCDME-456: Fix OAuth2 token refresh"
User: "commit the changes" (no ticket mentioned) → Ask for ticket, then commit once provided.
User: "push and create MR for EPMCDME-321"
- Check for existing MR
- Commit:
EPMCDME-321: <description> - Push branch
- Create MR titled
EPMCDME-321: <description>
User: "push my changes"
- Check if MR exists
- Push to existing MR, or push-only if none exists (don't create MR unless asked)
Source: codemie-ai/codemie-mcp-connect-service — distributed by TomeVault.