
Merge
- 44 installs
- 6 repo stars
- Updated July 22, 2026
- julianobarbosa/claude-code-skills
Merge strategies and conflict resolution in version control.
About
Merge. Combine merge-and-cleanup and merge-to-main into one flow. Default to fast-forward; preserve a merge commit when fast-forward is not possible.
- Prefer ff-only for linear history
- Never use --no-verify if a pre-push hook fails
Merge by the numbers
- 44 all-time installs (skills.sh)
- +1 installs in the week ending Aug 2, 2026 (Skillselion tracking)
- Ranked #314 of 733 Git & Pull Requests skills by installs in the Skillselion catalog
- Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/julianobarbosa/claude-code-skills --skill mergeAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 44 |
|---|---|
| repo stars | ★ 6 |
| Last updated | July 22, 2026 |
| Repository | julianobarbosa/claude-code-skills ↗ |
What it does
Merge strategies and conflict resolution in version control.
Files
Merge
Combine merge-and-cleanup and merge-to-main into one flow. Default to fast-forward; preserve a merge commit when fast-forward isn't possible or the user asks for one. Always interactive about deleting branches and worktrees.
Flow
1. Refuse if already on main. If git rev-parse --abbrev-ref HEAD returns main (or master), stop and report — there's nothing to merge. 2. Working tree must be clean. If there are uncommitted changes, ask the user whether to commit, stash, or abort. Do not silently stash. 3. Capture the feature branch name — FEATURE=$(git rev-parse --abbrev-ref HEAD). 4. Sync main.
git checkout maingit pull --ff-only origin main
5. Try fast-forward merge first.
git merge --ff-only "$FEATURE"- If it succeeds, history is linear — done with the merge step.
- If it fails (branch diverged), proceed to step 6.
6. Fall back to merge commit — git merge --no-ff "$FEATURE".
- If there are conflicts, stop and report. Do not auto-resolve.
- Write a meaningful merge-commit message; do not accept the default if it's just "Merge branch …".
7. Push — git push origin main. 8. Interactive cleanup. Ask the user: "Delete $FEATURE (local + remote) and any associated worktree?"
- On yes:
- If a worktree exists for
$FEATURE(git worktree list | grep -F "$FEATURE"), `cd` to the main repo dir first, thengit worktree remove <path>. git branch -d "$FEATURE"(use-Donly if user explicitly confirms —-drefuses if branch isn't merged, which is the safety we want).git push origin --delete "$FEATURE"(ignore failure if branch was never pushed).- On no: leave everything in place.
9. Report final status — commit hash on main, whether branch was deleted, whether a worktree was removed.
Notes
- Prefer ff-only. Linear history is easier to reason about. Only fall back to a merge commit when the branch genuinely diverged.
- Never `--no-verify`. If a pre-push hook fails, fix the underlying issue; don't bypass.
- Worktree-first cleanup. If the feature branch was developed in a worktree, you cannot delete the branch from inside the worktree. Always
cdto the main repo working directory first. - Conflict policy. This skill does not auto-resolve conflicts. If
git mergereports a conflict, stop and surface it to the user — they decide.
Gotchas
git pull --ff-onlyon main fails if main has diverged locally (e.g., you committed directly to main). That's a different problem — surface it; don't paper over with--rebase.git branch -drefuses on unmerged branches. That refusal is your safety net — never automatically promote to-D.git push origin --deleteexits non-zero if the remote branch doesn't exist. That's fine in this flow (branch was local-only) — log and continue.- macOS case-insensitive filesystems can mask case-only conflicts; if the feature branch differs only in case from another branch,
git checkoutwill surprise you.