From sd0x-dev-flow
Analyzes source vs target branch pre-merge: commit stats, conflict detection, file impacts. Outputs report + suggested commands (analysis-only, no auto-merge).
npx claudepluginhub sd0xdev/sd0x-dev-flow --plugin sd0x-dev-flowThis skill is limited to using the following tools:
Analyze source branch vs target branch, detect conflicts, output analysis report with suggested commands. **v1 is analysis-only** — does not execute merge/commit/push.
Analyzes git merge conflicts by type and context, proposes automated/manual resolutions, and validates fixes. Handles content, structural, semantic, and formatting issues.
Audits git code changes across 13 quality dimensions before or after merge, auto-scoping based on branch/commits/uncommitted state or user input, outputs prioritized tasks by file.
Generates partial rebase plan table and git rebase --onto command for squash-merge repos by auto-detecting commits to keep or drop.
Share bugs, ideas, or general feedback.
Analyze source branch vs target branch, detect conflicts, output analysis report with suggested commands. v1 is analysis-only — does not execute merge/commit/push.
| Scenario | Use Instead |
|---|---|
| Commit code (not merge) | /smart-commit |
| Merge to main (production) | Manual PR flow |
| Just view diff | git diff <target>..<branch> |
| Rebase or squash | Manual operation |
/merge-prep <source-branch> [--target <branch>]
<source-branch>: Branch to merge (required)--target: Target branch (default: {TARGET_BRANCH} or main)sequenceDiagram
participant C as Claude
participant U as User
C->>C: Step 1: Validate prerequisites
C->>C: Step 2: Pre-merge analysis
C->>U: Show analysis report
U->>C: Acknowledge
C->>C: Step 3: Conflict analysis (if any)
C->>U: Show conflict details + resolution suggestions
C->>C: Step 4: Generate merge commands
C->>U: Output commands for manual execution
# 1a. Verify source branch exists
git rev-parse --verify <branch>
# 1b. Verify target branch exists
git rev-parse --verify <target>
# 1c. Verify working tree is clean
git status --porcelain
| Check | Failure Action |
|---|---|
| Branch doesn't exist | Halt, list available branches |
| Target not found | Halt, suggest creating it |
| Uncommitted changes | Halt, suggest /smart-commit first |
Run the analysis script:
bash skills/merge-prep/scripts/pre-merge-check.sh <branch> [target]
Script outputs JSON containing:
merge_base: Common ancestorsource_commits: New commits on source branchtarget_commits: Commits on target that source doesn't havehas_conflicts: Whether conflicts existconflict_files: List of conflict filesfile_stats: Affected file statisticsDisplay analysis report:
## Pre-merge Analysis
| Item | Value |
|------|-------|
| Source branch | feat/new-feature |
| Target branch | main |
| Common ancestor | b03ad72a |
| New commits | 12 |
| Affected files | 46 |
| Predicted conflicts | 9 files |
### Recent Commits
| Hash | Message |
|------|---------|
| abc1234 | feat: Add new API endpoint |
| def5678 | test: Add integration tests |
For each conflict file, analyze commit history to determine conflict pattern:
| Pattern | Detection | Suggested Strategy |
|---|---|---|
| Iterative (v1→v3) | Both sides changed, source is superset | Take source |
| Parallel modification | Different people changed different logic | Per-hunk selection |
| Hotfix conflict | Target has hotfix merge, source doesn't | Take target |
| Doc add/add | Both sides added same-name file | Take source |
Display resolution suggestions:
### Conflict Files
| # | File | Pattern | Suggestion | Reason |
|---|------|---------|------------|--------|
| 1 | src/xxx.ts | Iterative | Take source | v3 includes all v1 changes |
| 2 | src/yyy.ts | Parallel | Per-hunk | Two sides changed different functions |
| 3 | docs/zzz.md | add/add | Take source | Target version is outdated |
Output commands for manual execution:
## Suggested Merge Commands
### Option A: Merge commit (recommended)
```bash
git checkout <target>
git pull --ff-only origin <target>
git merge <source> --no-ff
# Resolve conflicts if any
# git add <resolved-files>
# git commit
git push origin <target>
git checkout <target>
git pull --ff-only origin <target>
git merge --squash <source>
git commit -m "merge: Merge <source> into <target>"
git push origin <target>
### Step 5: Summary
```markdown
## Merge Summary
| Item | Value |
|------|-------|
| Source | feat/new-feature |
| Target | main |
| Commits | 12 |
| Files | 46 |
| Conflicts | 9 (resolution suggestions provided) |
| Tickets | PROJ-520, PROJ-123 |
⚠️ This is an analysis-only report. Execute the commands manually.
Supports /merge-prep branch1 branch2 branch3 --target develop:
git mergegit pushgit commit| File | Purpose | When to Read |
|---|---|---|
| pre-merge-check.sh | Pre-merge analysis script | Step 2 |