skills/merge-branch-into-current/SKILL.md
Merge a specified branch into the current branch with a merge commit. Use this when the user wants to merge one branch into the current branch, or when Codex should auto-detect the source branch that has commits after the current branch. The skill checks whether the source branch and target branch have uncommitted work in any active git worktree, and resolves merge conflicts autonomously by default.
npx skillsauth add hu-wentao/wyatt_skills merge-branch-into-currentInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill inside a Git repository when the goal is to merge one branch into the current branch and keep an explicit merge commit.
Default behavior:
git merge --no-ffDo not use squash merge or rebase unless the user explicitly overrides the request.
Collect:
If the user gave both names, use them directly after verifying they exist.
If the user did not give names, inspect the repository:
git branch --show-current
git branch --format='%(refname:short)'
When resolving the specified branch automatically, inspect local branches relative to the current branch:
git rev-list --count CURRENT_BRANCH..BRANCH is at least 1If there are multiple unmerged branches in the repository, narrow them to the branches that have commits after the current branch by using the CURRENT_BRANCH..BRANCH ahead count above.
If exactly one local branch satisfies these conditions, auto-select it as the source branch and continue without asking:
If more than one branch has commits after the current branch, stop and ask the user to specify which one should be the source branch. Target branch remains the current branch unless the user states otherwise.
If no branch has commits after the current branch, stop and ask the user for the source branch name.
Verify the repository and branch state before merging:
git rev-parse --show-toplevel
git branch --show-current
git show-ref --verify --quiet refs/heads/<source-branch>
git show-ref --verify --quiet refs/heads/<target-branch>
The merge must run from a worktree currently checked out on the target branch. If the current worktree is not on the target branch, stop and tell the user to switch first.
Run the bundled script:
scripts/merge_branch_into_current.sh [source-branch] [target-branch]
The script must:
git worktree list --porcelaingit status --short inside each matching worktreeIf a matching branch has no active worktree, treat it as clean because Git cannot hold uncommitted state for that branch without a checked-out worktree.
When a matching branch is dirty, handle it based on the user's wording:
When stopping, clearly report which branch and which worktree path is dirty.
Commit flow requirements when the user requested "提交并合并":
git add -Ascripts/merge_branch_into_current.sh [source-branch] [target-branch] to ensure both branches are clean before mergeIf both branches are clean, run:
git merge --no-ff <source-branch>
This preserves a merge commit even when fast-forward would be possible.
If merge conflicts occur:
git status --short and git diff --name-only --diff-filter=Uours / theirs resolution unless the user explicitly requested that policy or the repository already enforces it for the affected filesgit commit --no-edit or git merge --continueOn success, report:
git rev-parse HEADmerge_branch_into_current.sh: resolves branches when possible, checks worktree cleanliness for the source and target branches, runs git merge --no-ff, and reports conflicts so the caller can continue autonomous resolution.development
Proven patterns for building or refining Reflex admin dashboards, user portals, operations consoles, and classic sidebar-plus-content management UIs. Use when editing `.py` files that import `reflex as rx`, creating metric cards, left navigation sidebars, status panels, action forms, code or result blocks, or responsive dashboard pages. When bootstrapping a new Reflex app, prefer `reflex init --template dashboard` by default, and switch to `customer_data_app` or `api_admin_panel` only when the product shape matches those templates more closely.
development
Build, debug, and refactor Streamlit apps and widgets. Use when Codex works on Streamlit UI files, session_state behavior, rerun/callback bugs, st.data_editor or dataframe widgets, layout parameters, widget keys, Streamlit version compatibility, or deprecated/new parameters such as width="stretch" replacing older container-width patterns.
development
Create a Dart-based macOS background activity process managed by launchd. Use when Codex needs to scaffold or fix a LaunchAgent for a Dart program, generate the executable entrypoint, write the plist, or ensure App Background Activity shows the intended process name instead of a shell wrapper.
development
Prepare, build, and publish a Flutter Web app to S3-compatible object storage. Use when Codex needs to bump or update pubspec.yaml version, create a Flutter Web release tag, configure S3 deployment, build build/web, upload or promote web assets, or inspect a Flutter Web S3 release workflow.