Merge To
Overview
Use this skill to merge a finished branch into the integration branches dev and sit with a consistent, safety-first workflow. Keep the target limited to those two branches; if the user does not specify one, process dev first and then sit.
Workflow
- Confirm the repository path and source branch. If the user does not say otherwise, treat the current branch as the source branch.
- Refuse to continue if the current branch or default source branch is an integration or release branch:
devsitmaster- any branch named
releaseor starting withrelease/orrelease-
- Determine the target set:
- if the user names
dev, merge only todev - if the user names
sit, merge only tosit - if the user does not specify a target, merge to
devand thensit, but skip any target whose name matches the source branch
- if the user names
- Check the safety gates before making changes:
- require a clean working tree
- refuse
source == targetwhen the target is explicitly specified - stop if any requested target branch is missing both locally and on the selected remote
- Run the bundled script:
python ...\merge-to\scripts\merge_to.py --repo <repo-path> [--target <dev|sit>]
- Review the result. The script should:
- remember the original branch
- check out each target branch in sequence
- optionally sync the target branch from the remote
- merge the source branch
- push the target branch unless disabled
- continue to the next target only after the current target succeeds
- check out the original branch in a
finallypath
- If the merge conflicts, report the conflict clearly. The script attempts
git merge --abortbefore switching away so the source branch stays usable. - If the repository requires a specific strategy, pass flags instead of inventing ad-hoc commands:
--merge-mode mergefor a normalgit merge--merge-mode no-ffto force a merge commit--merge-mode ff-onlyto refuse non-fast-forward merges--no-sync-targetif the user explicitly wants to skipgit pull --ff-only--no-pushif the user only wants the local merge prepared
Examples
Use $merge-to to merge my current branch into dev, push it, and come back.
Use $merge-to to merge this branch into sit with --merge-mode no-ff.
Use $merge-to in D:\idea-workspace\znder-erp and, if I do not specify a target, merge the branch into dev and sit.
Script
The bundled script lives at scripts/merge_to.py.
Preferred commands:
python ...\merge-to\scripts\merge_to.py --repo <repo-path> --target dev
python ...\merge-to\scripts\merge_to.py --repo <repo-path>
Optional flags:
--source <branch>to merge a branch other than the current one--target <dev|sit>to merge to only one integration branch--remote <name>to use a remote other thanorigin--merge-mode <merge|no-ff|ff-only>--no-sync-target--no-push--dry-run
Failure Handling
- Stop immediately on a dirty working tree, a protected source branch, a missing branch, a merge conflict, or a checkout failure.
- Tell the user which target branch failed and whether any earlier target was already pushed.
- Surface a failed restore to the original branch as the highest-priority issue.