Skip to content
Development
Skill

/ase-repo-merge

Merge a Git source branch, including its still uncommitted changes, into a target branch through a regular merge, a rebase with fast-forward, or a squash merge, resolving merge conflicts semantically, check that the source branch landed, and emit a MERGED, CONFLICT, or FAILED

BOOST
From plugin
ase
5657 skills10 agents
Install
$ npx -y skills add rse/ase --skill ase-repo-merge --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/ase-repo-merge

Context preview

The summary Claude sees to decide when to auto-load this skill.

Merge a Git source branch, including its still uncommitted changes, into a target branch through a regular merge, a rebase with fast-forward, or a squash merge, resolving merge conflicts semantically, check that the source branch landed, and emit a MERGED, CONFLICT, or FAILED

SKILL.md

ase-repo-merge.SKILL.md
name: ase-repo-merge
argument-hint: "[--help|-h] [--target|-t <target-branch>] [--mode|-m merge|rebase|squash] [--cleanup|-c] <source-branch>"
description: >
    Merge a Git source branch, including its still uncommitted changes,
    into a target branch through a regular merge, a rebase with
    fast-forward, or a squash merge, resolving merge conflicts semantically, check
    that the source branch landed, and emit a MERGED, CONFLICT, or FAILED
    verdict. Use when the user calls to "merge", "integrate", or "land" a
    branch.
user-invocable: true
disable-model-invocation: false
effort: high
allowed-tools:
    - "Bash(git *)"
    - "Bash(mkdir -p *)"
    - "Bash(cp -p *)"
    - "Bash(rm -rf *)"
    - "Read"
    - "Edit"
    - "Write"

@${CLAUDE_SKILL_DIR}/../../meta/ase-control.md @${CLAUDE_SKILL_DIR}/../../meta/ase-skill.md @${CLAUDE_SKILL_DIR}/../../meta/ase-getopt.md

<purpose name="ase-repo-merge"> Merge a Branch </purpose>

<expand name="getopt" arg1="ase-repo-merge" arg2="--target|-t=current --mode|-m=(merge|rebase|squash) --cleanup|-c"> $ARGUMENTS </expand>

<objective> *Merge* the source branch, including its still *uncommitted* changes, into the target branch, *resolve* all merge conflicts *semantically*, *check* that the source branch landed, and report the *merge verdict*. </objective>

@${CLAUDE_SKILL_DIR}/../../meta/ase-common-resolve.md

<define name="source-rollback"> If <source-commit/> is not empty and <merged/> is not equal `true`, undo the commit of the pending source changes of STEP 2, so they are uncommitted again: run the command `git -C "<source-dir/>" rev-parse HEAD` and, only if its output equals <source-commit/>, run the command `git -C "<source-dir/>" reset --quiet --mixed "<source-commit/>~1"`. </define>

<define name="merge-fail"> First expand the following:

<expand name="source-rollback"></expand>

Then only output the following <template/> and then immediately *STOP* processing the entire current skill:

<template> ⧉ **ASE**: ✪ skill: **ase-repo-merge**, ▶ ERROR: <arg1/>, ▶ MERGE VERDICT: **FAILED** </template> </define>

<flow>

1. <step id="STEP 1: Determine Branches">

1. Set <source-commit/> to empty, <merged/> to `false`, and <squashed/> to `false`.

2. Set <source/> to <getopt-arguments/> with any leading and trailing whitespace stripped. If <source/> is empty or contains whitespace, expand the following:

<expand name="merge-fail" arg1="exactly one source branch required"></expand>

3. Determine the *checked-out branch* by running the command `git branch --show-current` (taken exactly as given) and capturing its output into <current-branch/>. If <getopt-option-target/> is `current`, set <target><current-branch/></target>, otherwise set <target><getopt-option-target/></target>. If <target/> is empty (detached `HEAD`), expand the following:

<expand name="merge-fail" arg1="no target branch determinable"></expand>

4. For each of the branches <source/> and <target/>, run the command `git rev-parse --verify --quiet "refs/heads/<branch/>"` (with <branch/> substituted). If it fails for a branch, expand the following:

<expand name="merge-fail" arg1="branch **<branch/>** does not exist"></expand>

5. Determine the *worktrees* by running the command `git worktree list --porcelain` (taken exactly as given). Set <source-dir/> to the `worktree` path of the entry whose `branch` line is `refs/heads/<source/>` (or to empty if there is none), and set <target-dir/> to the `worktree` path of the entry whose `branch` line is `refs/heads/<target/>` (or to empty if there is none). Do not output anything.

</step>

2. <step id="STEP 2: Commit Pending Source Changes">

1. If <source-dir/> is empty, skip this entire STEP 2, as a branch not checked out anywhere carries no uncommitted changes.

2. Run the command `git -C "<source-dir/>" status --porcelain`. If its output is empty, skip the remaining items of this STEP 2.

3. Stage all changes by running the command `git -C "<source-dir/>" add --all`, inspect them by running the command `git -C "<source-dir/>" diff --cached`, and craft a commit <message/> in the format `<type/>: <summary/>`, where <type/> is one of `FEATURE`, `IMPROVEMENT`, `BUGFIX`, `UPDATE`, `CLEANUP`, or `REFACTOR` and <summary/> is a 60-80 character, imperative-mood summary without a trailing period, without Markdown formatting, and without any double-quote (`"`), backtick (`` ` ``), dollar (`$`), or backslash (`\`) characters.

4. Commit the changes by running the command `git -C "<source-dir/>" commit -m "<message/>"`. If it fails, unstage the changes again by running the command `git -C "<source-dir/>" reset --quiet` and expand the following:

<expand name="merge-fail" arg1="pending changes of branch **<source/>** failed to commit"></expand>

5. Capture the output of the command `git -C "<source-dir/>" rev-parse HEAD` into <source-commit/>. If <source/> equals <target/>, set <merged/> to `true`, as the committed changes already landed on the target branch.

6. Only output the following <template/>:

<template> ⧉ **ASE**: ✪ skill: **ase-repo-merge**, ⎇ branch: **<source/>**, ▶ status: **pending changes committed** </template>

</step>

3. <step id="STEP 3: Merge Source into Target">

1. If <source/> equals <target/>, skip this entire STEP 3, as the committed changes already landed on the target branch.

2. If <target-dir/> is empty, expand the following:

<expand name="merge-fail" arg1="target branch **<target/>** is not checked out in any worktree"></expand>

3. Run the command `git -C "<target-dir/>" status --

Read more
Ships withase

Agentic Software Engineering (ASE)

Get the whole plugin

Other skills on ase.