git-merge

A Git command workflow for merging the current working branch into the main branch, with checks for the repository, uncommitted changes, remote updates, and user confirmation.

In plain words
What is it for?
Preparing and carrying out a safe local or remote-synced branch merge after the working tree is clean.
Why use it?
It reduces the risk of merging from the wrong branch, losing local work, or merging without checking the remote state.

Command for Claude Code

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/robconery/kolea/git-merge
Clone the repo
git clone --depth 1 https://github.com/robconery/kolea

Made for: Claude Code.

Per session 18 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,137 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.00018 $0.01137
Opus 5 $0.00009 $0.00568
Sonnet 5 $0.00004 $0.00227
Haiku 4.5 $0.00002 $0.00114

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

Security

Grade A, and why

git-merge 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 2d 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.

Origin

This is a copy

100% identical to git-merge — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/commands/git-merge.md · 117 lines

How it starts

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

git-merge

Bring a working branch into main. Refuses to do anything destructive or surprising — every step is checked, then confirmed.

Preflight

  1. In a git repo? git rev-parse --is-inside-work-tree. Refuse if not.
  2. Identify branches:
    • git branch --show-current → source branch
    • Default target is main (or master if no main exists).
  3. Same-branch guard. If the source branch equals the target, refuse with a clear message — there's nothing to merge.

Working-tree check

  1. git status -s.
  2. If there are uncommitted changes, stop and ask:
    • Commit them first (suggest /git-commit).
    • Stash them (git stash push -m "pre-merge stash") — note the stash ref in the report so the user can git stash pop after.
    • Discard (only if the user explicitly says so — never the default).
  3. Do not proceed with a dirty tree.

Remote sync check

  1. git remote -v. If no remote:
    • Skip the remote sync; proceed with a local merge.
    • Mention in the report that no remote was found.
  2. If a remote exists:
    • git fetch origin --prune
    • Compare main with origin/main:
      • git rev-list --left-right --count main...origin/main → tells us ahead/behind counts.
    • If local main is behind origin/main: tell the user, and after the working-tree is clean, fast-forward local main before merging (git switch main && git pull --ff-only).
    • If local main is ahead of origin/main: warn — that's unpushed work on main. Ask before continuing; offer to push first.
    • If they have diverged: stop. This is not the time for a /git-merge — recommend rebasing or pulling with --rebase first, and let the user decide.
  3. Also fetch the source branch's remote tracking ref if it exists, and warn if origin/<branch> is ahead of the local branch (someone else pushed).

Confirm before doing anything destructive

Use AskUserQuestion to confirm in one batch:

Read the full file on GitHub · 117 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. 2d ago First seen · 117 lines · 18 tokens per session scan A 0348067079ad

Subscribe to this mod's changes

git-merge is a command published in the GitHub repository robconery/kolea (1 stars, last pushed 2d ago), licensed MIT. It adds 18 tokens to every session and 1,137 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to git-merge, differing in 0 lines, and is treated as a copy.