Git Rebase with Intelligent Conflict Resolution Quick Start For most rebases with multiple commits, use the squash-first strategy to resolve conflicts only once: This approach resolves conflicts once instead of per-commit, saving time and mental overhead. Core Workflow: Conflict Analysis & Resolution Copy this checklist and mark progress: Step 1: Create Safety Backup ALWAYS do this first. If rebase goes wrong, you can recover: This costs nothing and saves hours of work if something goes wrong. Step 2: Fetch Latest Changes Ensure you have the most recent remote state: Understand how many commi…

; then\n echo \" ✓ No conflict markers found\"\nelse\n echo \" ❌ FOUND conflict markers:\"\n git grep -l '\u003c\u003c\u003c\u003c\u003c\u003c\\|======\\|>>>>>>' 2>/dev/null || true\n echo \"\"\n echo \" ⚠️ Please resolve these files before continuing\"\n EXIT_CODE=1\nfi\necho \"\"\n\n# 2. Check for unresolved git conflicts\necho \"2️⃣ Checking git status...\"\nif [ -z \"$(git diff --name-only --diff-filter=U)\" ]; then\n echo \" ✓ No unresolved conflicts in git status\"\nelse\n echo \" ❌ Git still shows unresolved conflicts:\"\n git diff --name-only --diff-filter=U | sed 's/^/ - /'\n EXIT_CODE=1\nfi\necho \"\"\n\n# 3. Check if working directory is clean\necho \"3️⃣ Checking working directory...\"\nif git status --porcelain | grep -q '^ M\\| ??'; then\n echo \" ⚠️ Unstaged changes found:\"\n git status --short | sed 's/^/ /'\n echo \"\"\n echo \" Tip: Run 'git add .' to stage all changes\"\nelse\n echo \" ✓ Working directory clean\"\nfi\necho \"\"\n\n# 4. Check for duplicate code (merged sections)\necho \"4️⃣ Checking for duplicate code patterns...\"\nCOMMON_DUPES=$(git diff HEAD | grep -c '^+.*{

Git Rebase with Intelligent Conflict Resolution Quick Start For most rebases with multiple commits, use the squash-first strategy to resolve conflicts only once: This approach resolves conflicts once instead of per-commit, saving time and mental overhead. Core Workflow: Conflict Analysis & Resolution Copy this checklist and mark progress: Step 1: Create Safety Backup ALWAYS do this first. If rebase goes wrong, you can recover: This costs nothing and saves hours of work if something goes wrong. Step 2: Fetch Latest Changes Ensure you have the most recent remote state: Understand how many commi…

|| echo 0)\nif [ \"$COMMON_DUPES\" -lt 10 ]; then\n echo \" ✓ No obvious code duplication detected\"\nelse\n echo \" ⚠️ Possible code duplication (many new code blocks):\"\n echo \" Manual review recommended\"\nfi\necho \"\"\n\n# 5. Check for common merge markers in comments\necho \"5️⃣ Checking for merge message artifacts...\"\nif git diff HEAD | grep -i \"merged\\|conflict\\|cherry-pick\\|rebase\"; then\n echo \" ⚠️ Found merge-related comments in changes\"\n echo \" Review to ensure they're intentional\"\nelse\n echo \" ✓ No merge artifacts in comments\"\nfi\necho \"\"\n\n# 6. Show changed files\necho \"6️⃣ Changed Files Summary:\"\nCHANGED=$(git diff --name-only)\nCHANGED_COUNT=$(echo \"$CHANGED\" | grep -c . || echo 0)\necho \" $CHANGED_COUNT files changed:\"\necho \"$CHANGED\" | sed 's/^/ - /'\necho \"\"\n\n# 7. Show stats\necho \"7️⃣ Diff Statistics:\"\ngit diff --stat | sed 's/^/ /'\necho \"\"\n\n# Final status\necho \"======================================\"\nif [ $EXIT_CODE -eq 0 ]; then\n echo \"✅ Validation PASSED - Ready for testing!\"\n echo \"\"\n echo \"Next steps:\"\n echo \" 1. Run tests: npm test\"\n echo \" 2. Run linter: npm run lint\"\n echo \" 3. Manual smoke test if needed\"\n echo \" 4. Then: git rebase --continue\"\nelse\n echo \"❌ Validation FAILED - Fix issues before proceeding\"\n echo \"\"\n echo \"Issues found:\"\n echo \" - Conflict markers remain (resolve in files)\"\n echo \" - Git shows unresolved conflicts\"\n echo \" - Other validation errors above\"\n echo \"\"\n echo \"Fix and run: bash validate-merge.sh\"\nfi\n\nexit $EXIT_CODE\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":3109,"content_sha256":"0ff3d79f97035e9208da2baa3a7faed02e29e4c7c3a311e8c82b28eb13d36695"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Git Rebase with Intelligent Conflict Resolution","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Quick Start","type":"text"}]},{"type":"paragraph","content":[{"text":"For most rebases with multiple commits, use the squash-first strategy to resolve conflicts only once:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Step 1: Backup current state\nbash scripts/pre-rebase-backup.sh\n\n# Step 2: Squash commits (interactive rebase on current branch)\ngit rebase -i $(git merge-base HEAD origin/main)\n\n# Step 3: Rebase onto target\ngit rebase origin/main\n\n# Step 4: If conflicts, resolve them once (see workflow below)\n# Then continue: git rebase --continue\n\n# Step 5: Force push safely\ngit push origin $(git rev-parse --abbrev-ref HEAD) --force-with-lease","type":"text"}]},{"type":"paragraph","content":[{"text":"This approach resolves conflicts once instead of per-commit, saving time and mental overhead.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Core Workflow: Conflict Analysis & Resolution","type":"text"}]},{"type":"paragraph","content":[{"text":"Copy this checklist and mark progress:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"Rebase Workflow:\n- [ ] Step 1: Create safety backup\n- [ ] Step 2: Fetch latest from target branch\n- [ ] Step 3: Analyze conflict scope\n- [ ] Step 4: Choose resolution strategy\n- [ ] Step 5: Apply conflict resolutions\n- [ ] Step 6: Validate merged code\n- [ ] Step 7: Run tests\n- [ ] Step 8: Force push safely","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 1: Create Safety Backup","type":"text"}]},{"type":"paragraph","content":[{"text":"ALWAYS do this first. If rebase goes wrong, you can recover:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Use the bundled script\nbash scripts/pre-rebase-backup.sh\n\n# Or manually create timestamped backup branch\nTIMESTAMP=$(date +%Y%m%d_%H%M%S)\ngit branch backup-rebase-$TIMESTAMP\n\n# Alternative: Create temporary ref to your current commit\ngit reflog # Note your current HEAD SHA for manual recovery","type":"text"}]},{"type":"paragraph","content":[{"text":"This costs nothing and saves hours of work if something goes wrong.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 2: Fetch Latest Changes","type":"text"}]},{"type":"paragraph","content":[{"text":"Ensure you have the most recent remote state:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Fetch without modifying local branches\ngit fetch origin\n\n# View the divergence\ngit log --oneline origin/main..HEAD # Your commits\ngit log --oneline HEAD..origin/main # New commits on main","type":"text"}]},{"type":"paragraph","content":[{"text":"Understand how many commits you're rebasing and how much main has changed.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 3: Analyze Conflict Scope","type":"text"}]},{"type":"paragraph","content":[{"text":"Before starting the rebase, predict conflicts:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# See which files you changed\ngit diff --name-only origin/main...HEAD\n\n# See which files main changed\ngit diff --name-only origin/main HEAD\n\n# Likely conflict areas: files changed in both","type":"text"}]},{"type":"paragraph","content":[{"text":"Key insight","type":"text","marks":[{"type":"strong"}]},{"text":": If you changed ","type":"text"},{"text":"auth.ts","type":"text","marks":[{"type":"code_inline"}]},{"text":" and so did main, you WILL get conflicts in ","type":"text"},{"text":"auth.ts","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"paragraph","content":[{"text":"Anticipating conflicts helps you understand how to resolve them.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 4: Choose Resolution Strategy","type":"text"}]},{"type":"paragraph","content":[{"text":"For detailed strategy comparison and decision matrix","type":"text","marks":[{"type":"strong"}]},{"text":", see ","type":"text"},{"text":"references/strategies.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/strategies.md","title":null}}]},{"text":".","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Strategy A: Squash First (Recommended for 3+ commits)","type":"text"}]},{"type":"paragraph","content":[{"text":"When to use","type":"text","marks":[{"type":"strong"}]},{"text":": Multiple feature commits with many conflicts expected","type":"text"}]},{"type":"paragraph","content":[{"text":"Why","type":"text","marks":[{"type":"strong"}]},{"text":": Reduces conflicts to one resolution phase instead of per-commit","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Interactive rebase on current branch first\ngit rebase -i $(git merge-base HEAD origin/main)\n\n# In editor, change all \"pick\" to \"squash\" (or 's') except first commit\n# Save and exit - commits are squashed into one\n# Edit commit message to describe the entire feature\n\n# Now rebase the squashed commit\ngit rebase origin/main\n\n# Resolve conflicts once, then git rebase --continue","type":"text"}]},{"type":"paragraph","content":[{"text":"Tradeoffs","type":"text","marks":[{"type":"strong"}]},{"text":": Lose individual commit history, but simpler conflict resolution","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Strategy B: Interactive Rebase with Conflict Awareness","type":"text"}]},{"type":"paragraph","content":[{"text":"When to use","type":"text","marks":[{"type":"strong"}]},{"text":": 1-2 commits, clean history, or complex per-commit logic","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git rebase -i origin/main\n\n# In editor, you can:\n# - Reorder commits to isolate conflict-prone ones\n# - Drop commits that are already in main (git detects this)\n# - Combine related commits before rebasing\n\n# Save and exit - rebase proceeds, stopping at conflicts","type":"text"}]},{"type":"paragraph","content":[{"text":"Tradeoffs","type":"text","marks":[{"type":"strong"}]},{"text":": More control, but more conflict-resolution iterations","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Strategy C: Simple Linear Rebase (Fastest, Auto-Resolution)","type":"text"}]},{"type":"paragraph","content":[{"text":"When to use","type":"text","marks":[{"type":"strong"}]},{"text":": Simple cases, no critical decisions, or in automated pipelines","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Rebase all commits at once\ngit rebase origin/main\n\n# If no conflicts, done\n# If conflicts, you resolve each one","type":"text"}]},{"type":"paragraph","content":[{"text":"Warning","type":"text","marks":[{"type":"strong"}]},{"text":": Not recommended for complex scenarios. Use Strategies A or B instead.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 5: Apply Conflict Resolutions","type":"text"}]},{"type":"paragraph","content":[{"text":"When ","type":"text"},{"text":"git rebase","type":"text","marks":[{"type":"code_inline"}]},{"text":" pauses with conflicts, use the analysis script:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Analyze conflicts\nbash scripts/analyze-conflicts.sh\n\n# See which files conflict\ngit status\n\n# For each conflicted file:\n# - RECOMMENDED: Use merge tool for visual clarity\ngit mergetool --no-prompt\n\n# - ALTERNATIVE: Manual edit in your editor\n# Search for conflict markers: \u003c\u003c\u003c\u003c\u003c\u003c, ======, >>>>>>","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Conflict Marker Anatomy","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"\u003c\u003c\u003c\u003c\u003c\u003c\u003c HEAD\n// Your current feature code\nfunction authenticate(token) {\n validateToken(token);\n return true;\n}\n=======\n// Main branch code (incoming)\nfunction authenticate(token) {\n if (!token) throw new Error(\"No token\");\n validateToken(token);\n setSession(token);\n return true;\n}\n>>>>>>> origin/main","type":"text"}]},{"type":"paragraph","content":[{"text":"Decision framework","type":"text","marks":[{"type":"strong"}]},{"text":" (before deleting markers):","type":"text"}]},{"type":"ordered_list","attrs":{"order":1,"listStyle":"number"},"content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Can you keep both?","type":"text","marks":[{"type":"strong"}]},{"text":" YES → Merge them intelligently","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"javascript"},"content":[{"text":"function authenticate(token) {\n if (!token) throw new Error(\"No token\"); // Keep main's validation\n validateToken(token);\n setSession(token); // Keep main's session setup\n return true; // Keep feature's return\n}","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Conflicting logic?","type":"text","marks":[{"type":"strong"}]},{"text":" Understand WHY they differ, then decide","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Did main add critical security checks? → Keep main's version","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Did your feature add essential functionality? → Keep feature's version","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Are they trying to do different things? → Combine intentionally","type":"text"}]}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Lost features?","type":"text","marks":[{"type":"strong"}]},{"text":" NEVER let a feature silently disappear","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"If you added authentication logic, ensure it's in final version","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"If main improved database access, ensure that's preserved","type":"text"}]}]}]}]}]},{"type":"paragraph","content":[{"text":"For detailed resolution patterns","type":"text","marks":[{"type":"strong"}]},{"text":", see ","type":"text"},{"text":"references/resolution-patterns.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/resolution-patterns.md","title":null}}]},{"text":".","type":"text"}]},{"type":"heading","attrs":{"level":4},"content":[{"text":"Key Resolution Principles","type":"text"}]},{"type":"paragraph","content":[{"text":"✅ DO","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Keep both versions' important functionality when possible","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use the merge tool for visual representation","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Add comments explaining merged conflicts: ","type":"text"},{"text":"// Merged from both versions: main's validation + feature's session setup","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Test each file after resolution","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"❌ DON'T","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Mindlessly pick one version without understanding both","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Delete conflict markers without understanding the conflict","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Keep duplicate code - merge intelligently","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Skip testing before continuing","type":"text"}]}]}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 6: Validate Merged Code","type":"text"}]},{"type":"paragraph","content":[{"text":"After resolving conflicts, validate the merged code:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Use the validation script\nbash scripts/validate-merge.sh\n\n# Manual checks:\n# 1. Check syntax\nnpm run lint # or eslint, pylint, etc.\n\n# 2. Check types (if TypeScript)\nnpm run type-check # or tsc --noEmit\n\n# 3. Spot-check key files\ngit diff HEAD origin/main -- \u003cconflicted-file>\n\n# If validation fails:\n# 1. Fix the issue in the file\n# 2. git add \u003cfile>\n# 3. git rebase --continue","type":"text"}]},{"type":"paragraph","content":[{"text":"Important","type":"text","marks":[{"type":"strong"}]},{"text":": Validation catches mistakes BEFORE you commit them.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 7: Run Tests","type":"text"}]},{"type":"paragraph","content":[{"text":"This is your safety net:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Run full test suite\nnpm test\n\n# Or specific tests for changed areas\nnpm test -- --testPathPattern=auth # If auth.ts was changed\n\n# If tests fail:\n# 1. Understand what broke\n# 2. Fix in the files\n# 3. git add \u003cfiles>\n# 4. git rebase --continue","type":"text"}]},{"type":"paragraph","content":[{"text":"Rule","type":"text","marks":[{"type":"strong"}]},{"text":": Never force-push code that fails tests.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Step 8: Force Push Safely","type":"text"}]},{"type":"paragraph","content":[{"text":"Use ","type":"text"},{"text":"--force-with-lease","type":"text","marks":[{"type":"code_inline"}]},{"text":" instead of ","type":"text"},{"text":"--force","type":"text","marks":[{"type":"code_inline"}]},{"text":". It protects against accidentally overwriting others' work:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# SAFE: Protects others' commits\ngit push origin $(git rev-parse --abbrev-ref HEAD) --force-with-lease\n\n# UNSAFE: Can overwrite others' work\ngit push origin your-branch -f # Don't do this\n\n# If force-with-lease fails:\n# Someone else pushed to your branch\n# Coordinate with them before forcing","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Common Scenarios & Strategies","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Scenario 1: Many Small Conflicts Across 5+ Commits","type":"text"}]},{"type":"paragraph","content":[{"text":"Use","type":"text","marks":[{"type":"strong"}]},{"text":": Squash-first strategy","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git rebase -i $(git merge-base HEAD origin/main)\n# Mark all but first commit as 's' (squash)\n# Save - commits squash into one\n\ngit rebase origin/main\n# Resolve conflicts once\ngit rebase --continue\n\n# Only one conflict-resolution phase!","type":"text"}]},{"type":"paragraph","content":[{"text":"Why","type":"text","marks":[{"type":"strong"}]},{"text":": Each commit might have conflicts. Squashing before rebasing means one pass.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Scenario 2: One Specific Commit Has Conflicts","type":"text"}]},{"type":"paragraph","content":[{"text":"Use","type":"text","marks":[{"type":"strong"}]},{"text":": Target that commit with interactive rebase","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"git rebase -i origin/main\n\n# In editor, move the problematic commit to the end\n# Save - rebase proceeds, stopping at that commit\n\n# When it stops, you know exactly which commit conflicts\ngit status # See what changed in this commit\n\n# Resolve, then continue\ngit rebase --continue","type":"text"}]},{"type":"paragraph","content":[{"text":"Why","type":"text","marks":[{"type":"strong"}]},{"text":": Isolating the commit helps you understand what it's trying to do.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Scenario 3: Conflicts Keep Repeating (Same File, Different Commits)","type":"text"}]},{"type":"paragraph","content":[{"text":"Use","type":"text","marks":[{"type":"strong"}]},{"text":": Git rerere (reuse recorded resolution)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Enable rerere globally (one-time setup)\ngit config --global rerere.enabled true\n\n# Now when you hit the same conflict in a second commit,\n# Git automatically applies the first commit's resolution\n\ngit rebase origin/main\n\n# Git remembers your first conflict resolution\n# and replays it automatically for similar conflicts","type":"text"}]},{"type":"paragraph","content":[{"text":"Why","type":"text","marks":[{"type":"strong"}]},{"text":": When rebasing and hitting the same file repeatedly, rerere saves manual work.","type":"text"}]},{"type":"heading","attrs":{"level":3},"content":[{"text":"Scenario 4: Rebase Conflicts Are Too Complex","type":"text"}]},{"type":"paragraph","content":[{"text":"Emergency escape plan","type":"text","marks":[{"type":"strong"}]},{"text":":","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Abort the rebase - return to original state\ngit rebase --abort\n\n# Fall back to merge (safer for complex scenarios)\ngit merge origin/main\n\n# Or try a different approach:\n# - Squash your entire feature branch first\n# - Cherry-pick main's critical changes selectively","type":"text"}]},{"type":"paragraph","content":[{"text":"Important","type":"text","marks":[{"type":"strong"}]},{"text":": It's okay to abort and rethink. Better than a broken rebase.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Bundled Scripts","type":"text"}]},{"type":"paragraph","content":[{"text":"This skill includes helper scripts in ","type":"text"},{"text":"scripts/","type":"text","marks":[{"type":"code_inline"}]},{"text":":","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"pre-rebase-backup.sh","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":": Creates a safety backup before rebasing","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"analyze-conflicts.sh","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":": Analyzes current conflicts and provides detailed information","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"validate-merge.sh","type":"text","marks":[{"type":"code_inline"},{"type":"strong"}]},{"text":": Validates that merge/rebase is clean and ready for testing","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Run scripts with ","type":"text"},{"text":"bash scripts/\u003cscript-name>.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Reference Files","type":"text"}]},{"type":"paragraph","content":[{"text":"For detailed information on specific topics:","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Strategies","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"references/strategies.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/strategies.md","title":null}}]},{"text":" - Complete strategy comparison and decision matrix","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Resolution Patterns","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"references/resolution-patterns.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/resolution-patterns.md","title":null}}]},{"text":" - Common conflict resolution patterns and heuristics","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Troubleshooting","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"references/troubleshooting.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/troubleshooting.md","title":null}}]},{"text":" - Solutions to common rebase problems","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Automation","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"references/automation.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/automation.md","title":null}}]},{"text":" - Automated conflict resolution for CI/CD","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Scripts & Tools","type":"text","marks":[{"type":"strong"}]},{"text":": ","type":"text"},{"text":"references/scripts-tools.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/scripts-tools.md","title":null}}]},{"text":" - Additional git commands and tool usage","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Checklist: Before You Commit to Rebasing","type":"text"}]},{"type":"checkbox_list","attrs":{"id":null},"content":[{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Understand why you're rebasing (cleaner history, syncing with main, etc.)","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Backup your current branch: ","type":"text"},{"text":"bash scripts/pre-rebase-backup.sh","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Run tests on current branch - they should pass","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Fetch latest: ","type":"text"},{"text":"git fetch origin","type":"text","marks":[{"type":"code_inline"}]}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Understand what you'll be rebasing (5 commits? 50?)","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Understand main's recent changes (1 commit? Major refactor?)","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Choose your strategy (see ","type":"text"},{"text":"references/strategies.md","type":"text","marks":[{"type":"link","attrs":{"href":"references/strategies.md","title":null}}]},{"text":")","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Have your merge tool ready (if using GUI)","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Block 30 mins - don't rush conflict resolution","type":"text"}]}]},{"type":"checkbox_item","attrs":{"checked":false},"content":[{"type":"paragraph","content":[{"text":"Have tests ready to run after rebase","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"When NOT to Rebase","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Shared branches (use merge instead: ","type":"text"},{"text":"git merge origin/main","type":"text","marks":[{"type":"code_inline"}]},{"text":")","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Critical production code without comprehensive tests","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"When multiple people are pushing to the same branch","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"If you don't understand the conflicts you're seeing","type":"text"}]}]}]},{"type":"paragraph","content":[{"text":"Default to merge if uncertain.","type":"text","marks":[{"type":"strong"}]},{"text":" Merge is safer for collaborative work.","type":"text"}]},{"type":"paragraph","content":[{"text":"Use rebase when","type":"text","marks":[{"type":"strong"}]},{"text":": Solo feature branch, clean history matters, no shared dependencies.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Summary: The Rebase Philosophy","type":"text"}]},{"type":"paragraph","content":[{"text":"Rebasing is a tool for creating clean, linear commit history. ","type":"text"},{"text":"Used well","type":"text","marks":[{"type":"strong"}]},{"text":", it makes debugging and code review easier. ","type":"text"},{"text":"Used poorly","type":"text","marks":[{"type":"strong"}]},{"text":", it loses work.","type":"text"}]},{"type":"paragraph","content":[{"text":"The key principle","type":"text","marks":[{"type":"strong"}]},{"text":": Understand every conflict before resolving it. Don't automate away the thinking.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"With this Skill, you can rebase with confidence, understanding each decision and protecting your code throughout the process.","type":"text"}]}]},"metadata":{"date":"2026-06-05","name":"git-rebase","author":"@skillopedia","source":{"stars":387,"repo_name":"skills","origin_url":"https://github.com/pedronauck/skills/blob/HEAD/skills/mine/git-rebase/SKILL.md","repo_owner":"pedronauck","body_sha256":"2a3734fa739a17bbda6a462d9d86e298c00eaa4cc74faaa95d8b45088d6b5116","cluster_key":"b7106481d4802e4b81ca6f5ec4c51683e71724d31472c3c93264c00196c4dd6e","clean_bundle":{"format":"clean-skill-bundle-v1","source":"pedronauck/skills/skills/mine/git-rebase/SKILL.md","attachments":[{"id":"0604db95-fd3c-5ad1-8f76-ae41b26531e6","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/0604db95-fd3c-5ad1-8f76-ae41b26531e6/attachment.md","path":"references/automation.md","size":692,"sha256":"bac788b2aa172eba3440602ceffacaef307eb644acd14937dff5b30b36709525","contentType":"text/markdown; charset=utf-8"},{"id":"21ca4108-5238-5c4b-8780-952a34854866","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/21ca4108-5238-5c4b-8780-952a34854866/attachment.md","path":"references/resolution-patterns.md","size":1886,"sha256":"95a0c0abfd3fb0713a96abb26e47df1dd16708e78b0acf4d963dff94459da860","contentType":"text/markdown; charset=utf-8"},{"id":"08283c5a-9b82-59f0-8b8b-08b1b35d7708","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/08283c5a-9b82-59f0-8b8b-08b1b35d7708/attachment.md","path":"references/scripts-tools.md","size":1185,"sha256":"e4b9d9b9667f29ba352e0f61750e57ac14ddfd825139795830b581248cfd916b","contentType":"text/markdown; charset=utf-8"},{"id":"c3381e5f-62cf-5518-8086-a678cc5d0c47","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/c3381e5f-62cf-5518-8086-a678cc5d0c47/attachment.md","path":"references/strategies.md","size":8394,"sha256":"f3c90b00bddba9cc771abe194058ffc93236d916373ee84f696eeeb5c164755a","contentType":"text/markdown; charset=utf-8"},{"id":"1849a59e-9433-5ca0-b8f0-275805a71111","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/1849a59e-9433-5ca0-b8f0-275805a71111/attachment.md","path":"references/troubleshooting.md","size":1502,"sha256":"27ff5723411b15d27b26a04bc3b64931da0112af06d87bd2562bde8049db95bc","contentType":"text/markdown; charset=utf-8"},{"id":"e1355324-24ff-5d2c-b7aa-80cb015f67df","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/e1355324-24ff-5d2c-b7aa-80cb015f67df/attachment.sh","path":"scripts/analyze-conflicts.sh","size":2940,"sha256":"e9f46a80ace9d6abd3edfda204a4a24f06020825be89c4f252278f45a8736fc0","contentType":"application/x-sh; charset=utf-8"},{"id":"a05c8df5-77e7-544f-9274-c7de7e0582e6","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/a05c8df5-77e7-544f-9274-c7de7e0582e6/attachment.sh","path":"scripts/pre-rebase-backup.sh","size":2408,"sha256":"e6e00a4215b7c07ced34248c3b4b7ceb3e621a99b90e90ff931b6196e5b0d7a8","contentType":"application/x-sh; charset=utf-8"},{"id":"fda4d923-522a-5aed-8a69-ccd9e1374ab3","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/fda4d923-522a-5aed-8a69-ccd9e1374ab3/attachment.sh","path":"scripts/validate-merge.sh","size":3109,"sha256":"0ff3d79f97035e9208da2baa3a7faed02e29e4c7c3a311e8c82b28eb13d36695","contentType":"application/x-sh; charset=utf-8"}],"bundle_sha256":"14ede66ea39c38ebebd7169f250359c9fe06f1b04d84b2e78f43400338a7f5d3","attachment_count":8,"text_attachments":8,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/mine/git-rebase/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"integrations-apis","category_label":"Integrations"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"integrations-apis","metadata":{"author":"Pedro Nauck","github":"https://github.com/pedronauck","repository":"https://github.com/pedronauck/skills"},"import_tag":"clean-skills-v1","description":"Intelligently handle git rebase operations and resolve merge conflicts while preserving features and maintaining code quality. Use when rebasing feature branches, resolving conflicts across commits, and ensuring clean linear history without losing changes. Don't use for merge-commit workflows, cherry-picking individual commits, or initial repository setup."}},"renderedAt":1782979502920}

Git Rebase with Intelligent Conflict Resolution Quick Start For most rebases with multiple commits, use the squash-first strategy to resolve conflicts only once: This approach resolves conflicts once instead of per-commit, saving time and mental overhead. Core Workflow: Conflict Analysis & Resolution Copy this checklist and mark progress: Step 1: Create Safety Backup ALWAYS do this first. If rebase goes wrong, you can recover: This costs nothing and saves hours of work if something goes wrong. Step 2: Fetch Latest Changes Ensure you have the most recent remote state: Understand how many commi…