skills/git-workflows/skills/conflicts/SKILL.md
Guided conflict resolution for merge and rebase conflicts
npx skillsauth add dtsong/my-claude-setup Git ConflictsInstall 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.
git addgit merge --continue or git rebase --continue after resolution--file): reject .. traversal, null bytes, and shell metacharacters. Must be a path within the repository working tree.Get help resolving merge, rebase, or cherry-pick conflicts.
/git-conflicts # Analyze and help with current conflicts
/git-conflicts --status # Show conflict status only
/git-conflicts --file src/component.tsx # Focus on specific file
# Check what operation is in progress
if [ -d .git/rebase-merge ] || [ -d .git/rebase-apply ]; then
OPERATION="rebase"
elif [ -f .git/MERGE_HEAD ]; then
OPERATION="merge"
elif [ -f .git/CHERRY_PICK_HEAD ]; then
OPERATION="cherry-pick"
else
echo "No conflicts detected."
exit 0
fi
# Get list of conflicting files
CONFLICTS=$(git diff --name-only --diff-filter=U)
echo "Conflicting files:"
echo "$CONFLICTS"
# Count conflicts
COUNT=$(echo "$CONFLICTS" | wc -l)
echo "Total: $COUNT files with conflicts"
For each conflicting file, Claude will:
<<<<<<<, =======, >>>>>>>)Provide clear instructions for each file.
Conflict Resolution Guide
Operation: Merging main into feat/dark-mode
Conflicting files (2):
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. src/components/Header.tsx
Conflict type: Both branches modified the same lines
Your changes (HEAD):
- Added dark mode toggle button
- Changed header background color
Their changes (main):
- Updated logo component
- Changed header padding
Suggested resolution:
Keep both changes - they affect different aspects.
1. Keep the dark mode toggle (your change)
2. Keep the logo update (their change)
3. Merge the style changes carefully
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
2. src/styles/theme.css
Conflict type: Same CSS property modified differently
Your changes (HEAD):
--header-bg: #1a1a2e; /* dark mode */
Their changes (main):
--header-bg: #ffffff; /* light mode default */
Suggested resolution:
Both are needed! Create theme variants:
:root {
--header-bg: #ffffff;
}
[data-theme="dark"] {
--header-bg: #1a1a2e;
}
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Next steps:
1. Edit conflicting files (remove conflict markers)
2. git add <resolved-files>
3. git merge --continue (or git rebase --continue)
Or abort:
/git-abort
When focusing on a specific file:
Analyzing: src/components/Header.tsx
Conflict region 1 (lines 45-62):
<<<<<<< HEAD (your changes)
import { ThemeToggle } from './ThemeToggle';
export function Header() {
return (
<header className="bg-slate-900 dark:bg-slate-950">
<Logo />
<ThemeToggle />
=======
import { NewLogo } from './NewLogo';
export function Header() {
return (
<header className="bg-white p-4">
<NewLogo />
>>>>>>> main (their changes)
Analysis:
- You added ThemeToggle import and component
- They updated Logo to NewLogo
- Background colors differ (you: dark, they: light default)
Resolution suggestion:
Combine both changes:
import { ThemeToggle } from './ThemeToggle';
import { NewLogo } from './NewLogo';
export function Header() {
return (
<header className="bg-white dark:bg-slate-950 p-4">
<NewLogo />
<ThemeToggle />
Keep your version, discard theirs.
git checkout --ours <file>
git add <file>
Keep their version, discard yours.
git checkout --theirs <file>
git add <file>
Edit file to combine both changes (most common).
# Edit file to resolve
vim <file>
git add <file>
git mergetool <file>
| Pattern | Typical Resolution | |---------|-------------------| | Same line, different changes | Manual merge combining intent | | Deleted vs modified | Decide if deletion or modification wins | | Added file in both | Merge contents or pick one | | Renamed differently | Pick the better name, merge content | | Structural refactor | Usually accept refactor, reapply changes |
# Mark as resolved
git add <resolved-file>
# Continue the operation
git merge --continue # for merge
git rebase --continue # for rebase
git cherry-pick --continue # for cherry-pick
/git-abort if conflicts are too complex/git-merge-main or /git-rebase to start merge/rebase/git-push to update remotedevelopment
Use when planning implementation steps, deciding commit format, or structuring development approach. Provides brainstorm-plan-implement flow with conventional commits. Triggers on 'how should I approach this', 'commit format'.
development
Security audit checklist for web applications. Use when reviewing, auditing, or hardening a web app's security posture. Covers rate limiting, auth headers, IP blocking, CORS, security middleware, input validation, file upload limits, ORM usage, and password hashing. Triggers on requests like "review security", "harden this app", "security audit", "check for vulnerabilities", or when building/reviewing API endpoints.
development
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.