create-branch-and-mr

create-branch-and-mr is a command for coding agents from poter-aa/ai-code-workflow. It costs 0 tokens per session (2,532 once invoked), scanned A, original, MIT.

A workflow that commits current code changes, creates and pushes a Git branch, opens a GitLab Merge Request, and returns to the original branch. A Merge Request is a proposal for reviewing and merging code changes.

In plain words
What is it for?
Use it to package existing changes into a commit, generate a branch name, push the branch, and create a Merge Request in the configured GitLab project.
Why use it?
It automates several repetitive Git and GitLab steps while carrying the current changes into the review branch.

Command

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/poter-aa/ai-code-workflow/create-branch-and-mr
Clone the repo
git clone --depth 1 https://github.com/poter-aa/ai-code-workflow

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for create-branch-and-mr

README.md
[![agentmods](https://agentmods.dev/badge/commands/poter-aa/ai-code-workflow/create-branch-and-mr.svg)](https://agentmods.dev/commands/poter-aa/ai-code-workflow/create-branch-and-mr)
Your own site
<a href="https://agentmods.dev/commands/poter-aa/ai-code-workflow/create-branch-and-mr"><img src="https://agentmods.dev/badge/commands/poter-aa/ai-code-workflow/create-branch-and-mr.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,532 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02532
Opus 5 $0.00000 $0.01266
Sonnet 5 $0.00000 $0.00506
Haiku 4.5 $0.00000 $0.00253

Measured 4d ago against content hash 97dd4e8955f8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

create-branch-and-mr scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/create-branch-and-mr.md · 221 lines

How it starts

The opening of the file, as written. The whole thing — 221 lines — stays where its author put it; the contents beside it link to each section on GitHub.

创建分支并提交 MR

⚠️ 前置要求

必须配置 GitLab MCP 才能使用此工作流程!

在使用此工作流程之前,请确保:

  1. 已在 Cursor 中配置 GitLab MCP 服务器
  2. MCP 服务器已正确连接到 GitLab 实例(gitlab-ee.zhenguanyu.com)
  3. 已配置必要的认证信息(Token 等)

🚀 自动执行模式

此命令会自动执行所有步骤,无需用户确认!

执行此命令时,系统会:

  1. 自动检查:检查当前分支的所有改动(包括已暂存和未暂存的)
  2. 自动暂存:使用 git add -A 自动暂存所有改动(包括新增、修改、删除的文件)
  3. 自动提交:提交所有改动(使用最新提交的标题,或生成默认提交信息)
  4. 自动提取:从最新提交信息中提取标题和描述
  5. 自动生成:基于提交信息自动生成分支名(格式:feature/提交信息转kebab-case
  6. 自动创建:创建新分支、推送到远程、创建 MR、切换回原分支
  7. 默认配置
    • 目标分支:当前分支(原分支,即 CURRENT_BRANCH
    • 项目名:bolt-logistics2(自动搜索项目 ID)

工作流程说明

此工作流程用于完成以下 Git 和 GitLab 操作:

  1. 自动处理所有改动:自动暂存所有改动(包括未暂存的),然后提交
  2. 基于当前分支创建新分支(新分支会包含刚才的提交和所有代码变更)
  3. 将新分支推送到远程仓库
  4. 在 GitLab 上创建 Merge Request(自动使用提交信息作为标题和描述)
  5. 切换回原分支

重要:系统会自动处理所有改动(包括未暂存的),确保新分支包含完整的代码变更。

自动执行步骤

步骤 1: 检查并提交改动(自动)

系统会自动执行:

  1. 检查当前分支的所有改动(包括已暂存和未暂存的):git status
  2. 自动暂存所有改动git add -A(包括新增、修改、删除的文件)
  3. 检查是否有改动需要提交:
    • 如果有改动,自动提交(使用最新提交的标题,或生成默认提交信息)
    • 如果没有改动,检查是否有已提交的提交,如果有则继续下一步
  4. 重要:确保所有代码变更都被提交,包括未暂存的改动,这样新分支才会包含完整的代码变更

步骤 2: 提取提交信息并生成分支名(自动)

系统会自动执行:

  1. 获取最新提交信息(git log -1 --pretty=%B
  2. 从提交信息中提取标题(第一行)
  3. 自动生成分支名:
    • 格式:feature/{提交标题转kebab-case}
    • 示例:feat: 采购单行状态优化feature/purchase-order-status-optimize
    • 移除类型前缀(feat/fix/docs等)和特殊字符
    • 转换为小写并用连字符连接

步骤 3: 创建新分支(自动)

系统会自动执行:

# 获取当前分支名
CURRENT_BRANCH=$(git branch --show-current)

# 创建新分支(包含刚才的提交)
git checkout -b $NEW_BRANCH

步骤 4: 推送到远程仓库(自动)

系统会自动执行:

git push -u origin $NEW_BRANCH

步骤 5: 在 GitLab 上创建 Merge Request(自动)

系统会自动执行:

  1. 搜索项目获取项目 ID

    • 使用 MCP 工具 mcp_gitlab_search_repositories
    • 参数:search: "bolt-logistics2"
    • 从返回结果中获取项目 ID(id 字段)
  2. 创建 Merge Request

    • 使用 MCP 工具 mcp_gitlab_create_merge_request
    • project_id: 从步骤 5.1 获取的项目 ID
    • title: 使用最新提交的标题
    • description: 自动生成结构化描述(功能说明 + 主要改动)
    • source_branch: 新分支名
    • target_branch: 当前分支(原分支,即 CURRENT_BRANCH

Read the full file on GitHub · 221 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 221 lines · 0 tokens per session scan A 97dd4e8955f8

Subscribe to this mod's changes

create-branch-and-mr is a command published in the GitHub repository poter-aa/ai-code-workflow (4 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,532 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.