Skip to content

Instantly share code, notes, and snippets.

@sanjeed5
Created June 6, 2025 09:05
Show Gist options
  • Save sanjeed5/1880117e7260c1d9b80c7e9656101a1d to your computer and use it in GitHub Desktop.
Save sanjeed5/1880117e7260c1d9b80c7e9656101a1d to your computer and use it in GitHub Desktop.
Gitlab MR Creation Cursor Rule (to develop branch)
# GitLab Merge Request Creation Guide
## Overview
This rule provides guidance for creating GitLab merge requests (MRs) with appropriate titles based on the changes made compared to the `develop` branch. All MRs should target the `develop` branch, not `main`.
## MR Creation Workflow
### 1. Analyze Changes
Before creating the MR, analyze what changed:
```bash
# Check what files have changed
git diff develop --name-only
# Check the actual changes
git diff develop --stat
# Get commit messages since develop
git log develop..HEAD --oneline
```
### 2. Generate Title
Use this format: `[type]: Brief description of changes`
**Types**: `feat`, `fix`, `refactor`, `style`, `docs`, `test`, `chore`, `perf`, `ci`
**Examples**:
- `feat: Add user authentication with OAuth2`
- `fix: Resolve API timeout issues in chat service`
- `refactor: Extract reusable components from chat interface`
### 3. Confirm with User
Present this summary and get approval:
```
πŸ” MR Creation Summary:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
πŸ“ Title: [Generated Title]
🎯 Target: develop
🌿 Source: [current-branch-name]
πŸ“Š Changes: [Number] files modified
❓ Proceed with creating this MR? (y/n)
```
### 4. Create MR
Use the simplest approach that works:
```bash
# Primary method (recommended)
glab mr create --title "[Confirmed Title]" --target-branch develop --assignee @me
# If CLI has issues, use web interface
glab mr create --web
```
### 5. Troubleshooting
If `glab mr create` hangs or fails:
- Press Ctrl+C and use: `glab mr create --web`
- Or push branch manually: `git push -u origin $(git branch --show-current)` and create MR in web UI
## Important Notes
- **Always target `develop`** (never `main`)
- **Get user confirmation** before creating MR
- **Keep MRs focused** on single feature/fix
- **Use web interface** as fallback when CLI has issues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment