create-mr-gitlab-git
Skill0 starsChanged 9 months agoMITView on GitHub
Create a GitLab merge request from the current branch, deriving the title and description from the branch's git history.
- Commits and pushes
In this repository32 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- action-itemsSkill
- add-spikeSkill
- changelogSkill
- commitSkill
- create-branchSkill
- create-issue-branch-githubSkill
- create-issue-githubSkill
- create-pr-github-gitSkill
- create-pr-githubSkill
- decisionSkill
- emailSkill
- fix-issue-github-autoSkill
- fix-issue-githubSkill
- hldSkill
- implement-lldSkill
- jira-ticket-gitSkill
- jira-ticketSkill
- lldSkill
- prSkill
- reconcileSkill
- resolve-conflictsSkill
- resolve-open-questionsSkill
- reviewSkill
- spikeSkill
- standup-gitSkill
- standupSkill
- syncSkill
- tag-release-ansibleSkill
- tag-release-npmSkill
- tag-releaseSkill
- tldrSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 6 are distinctive, and 13 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
13
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 6
Create a GitLab merge request from the current branch, deriving the title and description from the branch's git history.
- Very specific: line 9
Check that glab is installed and authenticated by running glab auth status.
- Very specific: line 11
If the user passed an explicit target branch in $ARGUMENTS (e.g.
- Very specific: line 26
If exactly one branch is returned, use it as <base>.
- Very specific: line 27
If multiple branches tie for the lowest score (e.g.
- Very specific: line 28
If no branches were returned at all (no remote branches found), fall back to the repository's default branch: glab repo view --output json …
- Very specific: line 30
Run git rev-parse --abbrev-ref --symbolic-full-name @{upstream} to check if an upstream is set.
- Distinctive: line 31
If no upstream is set, run git push -u origin HEAD to push and set tracking.
- Distinctive: line 32
If an upstream is set, run git push to make sure the remote is up to date.
- Very specific: line 33
Run git log --oneline <base>..HEAD to list commits on this branch.
- Very specific: line 34
Run git diff <base>...HEAD --stat to understand what changed.
- Distinctive: line 35
Check for a GitLab MR description template:
- Very specific: line 36
Look for .gitlab/merge_request_templates/Default.md (the template GitLab applies automatically in the UI).
- Very specific: line 37
If that doesn't exist, look for any other file under .gitlab/merge_request_templates/*.md and use the first one found.
- Distinctive: line 38
If no template file exists, there is no template to follow.
- Distinctive: line 42
If no template was found, use this freeform structure instead:
- Very specific: line 47
Check if an MR already exists for this branch: glab mr list --source-branch "$(git branch --show-current)" --output json 2>/dev/null.
- Very specific: line 48
If no MR exists (empty list), run glab mr create --title "<title>" --description "<description>" --target-branch "<base>" to open one.
- Very specific: line 49
If an MR already exists, extract its IID from the JSON and run glab mr update <iid> --title "<title>" --description "<description>" …
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create a GitLab merge request from the current branch, deriving the title and description from the branch's git history.
Steps:
- Check that
glabis installed and authenticated by runningglab auth status. If not, tell the user and stop. - Determine the target branch:
- If the user passed an explicit target branch in $ARGUMENTS (e.g.
--target-branch <name>or--target <name>), use<name>directly as<base>and skip the rest of this step. Otherwise, find the closest remote ancestor of the current branch — i.e. the branch this feature branch was actually created from, not necessarily the repository's default branch. Run the following to score each remote branch by how many commits HEAD is ahead of the merge-base with that branch (lower = closer ancestor), then list every branch tied for the lowest score:
scored=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin/ \ | grep -v 'origin/HEAD' \ | grep -v "origin/$(git branch --show-current)" \ | while read branch; do base=$(git merge-base HEAD "$branch" 2>/dev/null) || continue echo "$(git rev-list --count "$base"..HEAD) $branch" done | sort -n) min=$(echo "$scored" | head -1 | awk '{print $1}') echo "$scored" | awk -v m="$min" '$1==m {print $2}' | sed 's|origin/||'- If exactly one branch is returned, use it as
<base>. - If multiple branches tie for the lowest score (e.g. several release branches diverged at the same point), tell the user which branches are tied and ask them which one to target. Use their answer as
<base>. - If no branches were returned at all (no remote branches found), fall back to the repository's default branch:
glab repo view --output json | jq -r '.defaultBranch'.
- If the user passed an explicit target branch in $ARGUMENTS (e.g.
- Push the current branch to the remote if needed:
- Run
git rev-parse --abbrev-ref --symbolic-full-name @{upstream}to check if an upstream is set. - If no upstream is set, run
git push -u origin HEADto push and set tracking. - If an upstream is set, run
git pushto make sure the remote is up to date.
- Run
- Run
git log --oneline <base>..HEADto list commits on this branch. - Run
git diff <base>...HEAD --statto understand what changed. - Check for a GitLab MR description template:
- Look for
.gitlab/merge_request_templates/Default.md(the template GitLab applies automatically in the UI). - If that doesn't exist, look for any other file under
.gitlab/merge_request_templates/*.mdand use the first one found. - If no template file exists, there is no template to follow.
- Look for
- Derive an MR title (imperative tense, under 72 chars) from the commits and diff.
- Derive the MR description from the commits and diff:
- If a template was found in step 6, fill it in: keep its section headers, checklists, and structure intact, and populate each section with real content derived from the commits and diff. Do not invent content for sections that don't apply — leave them empty or remove placeholder instructional text, but keep the section headers. Do not add sections the template doesn't have.
- If no template was found, use this freeform structure instead:
- What changed (2-4 sentences, plain English)
- Why it was needed if inferrable
- Notable implementation details as bullet points (optional)
- Either way, no filler like "This MR..." or vague words without specifics.
- Check if an MR already exists for this branch:
glab mr list --source-branch "$(git branch --show-current)" --output json 2>/dev/null.- If no MR exists (empty list), run
glab mr create --title "<title>" --description "<description>" --target-branch "<base>"to open one. Append any user-provided flags from $ARGUMENTS. - If an MR already exists, extract its IID from the JSON and run
glab mr update <iid> --title "<title>" --description "<description>" --target-branch "<base>"to update it.
- If no MR exists (empty list), run
- Print the MR URL.
$ARGUMENTS
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

