/git-advanced
Advanced git operations including rebase, bisect, cherry-pick, and conflict resolution. Use when rebasing branches, debugging with bisect, cherry-picking commits, or resolving complex merge conflicts.
$ npx -y skills add bybren-llc/safe-agentic-workflow --skill git-advanced --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/git-advanced
Context preview
The summary Claude sees to decide when to auto-load this skill.
Advanced git operations including rebase, bisect, cherry-pick, and conflict resolution. Use when rebasing branches, debugging with bisect, cherry-picking commits, or resolving complex merge conflicts.
SKILL.md
git-advanced.SKILL.mdname: git-advanced
description: Advanced git operations including rebase, bisect, cherry-pick, and conflict resolution. Use when rebasing branches, debugging with bisect, cherry-picking commits, or resolving complex merge conflicts.
allowed-tools: Read, Bash, Grep
Git Advanced Skill
Purpose
Provide guidance for advanced git operations with safety considerations. This project uses a **rebase-first workflow** with linear history—understand these patterns to avoid breaking the codebase.
When This Skill Applies
Invoke this skill when:
- Rebasing feature branches onto dev
- Using git bisect to find bugs
- Cherry-picking commits between branches
- Resolving complex merge conflicts
- Recovering from git mistakes
Stop-the-Line Conditions
FORBIDDEN Operations
# FORBIDDEN: Force push to protected branches
git push --force origin dev # ❌ NEVER
git push --force origin master # ❌ NEVER
# FORBIDDEN: Merge commits on dev branch
git merge feature-branch # ❌ Use rebase-and-merge PR strategy
# FORBIDDEN: Skip pre-commit hooks
git commit --no-verify # ❌ Hooks exist for a reason
# FORBIDDEN: Rewriting shared history
git rebase -i HEAD~5 && git push --force # ❌ If already pushed
SAFE Operations
# SAFE: Force-with-lease on your feature branch
git push --force-with-lease origin {{TICKET_PREFIX}}-XXX-feature # ✅ Safe
# SAFE: Interactive rebase before first push
git rebase -i origin/dev # ✅ Squash/clean local commits
# SAFE: Force push after conflict resolution
git rebase origin/dev && git push --force-with-lease origin {{TICKET_PREFIX}}-XXX-featureRebase Workflow (Standard)
Before Creating PR
# 1. Fetch latest changes
git fetch origin dev
# 2. Rebase onto latest dev
git rebase origin/dev
# 3. If conflicts, resolve them
git status # See conflicted files
# ... edit files to resolve ...
git add <resolved-files>
git rebase --continue
# 4. Push with force-with-lease
git push --force-with-lease origin {{TICKET_PREFIX}}-XXX-featureDuring PR Review (After Feedback)
# 1. Make requested changes
git add . && git commit -m "fix: address PR feedback [{{TICKET_PREFIX}}-XXX]"
# 2. Fetch and rebase again
git fetch origin dev
git rebase origin/dev
# 3. Push update
git push --force-with-lease origin {{TICKET_PREFIX}}-XXX-featureGit Bisect (Finding Bugs)
When to Use
Use bisect when you know a bug was introduced at some point but don't know which commit.
Bisect Workflow
# 1. Start bisect
git bisect start
# 2. Mark current state (has bug)
git bisect bad
# 3. Mark a known good commit
git bisect good <commit-sha>
# e.g., git bisect good abc1234
# 4. Git checks out middle commit - test it
yarn test:unit # or manual test
# 5. Tell git if this commit is good or bad
git bisect good # or
git bisect bad
# 6. Repeat until found
# Git will tell you the first bad commit
# 7. End bisect
git bisect reset
Automated Bisect
# Run a test script automatically
git bisect start HEAD abc1234
git bisect run yarn test:specific-test
Cherry-Pick (Selective Commits)
When to Use
- Backporting a fix to an older branch
- Pulling a specific commit from one branch to another
- Selective feature extraction
Cherry-Pick Workflow
# 1. Find the commit SHA
git log --oneline branch-name | head -20
# 2. Cherry-pick to current branch
git cherry-pick <commit-sha>
# 3. If conflicts, resolve them
git status
# ... resolve conflicts ...
git add <resolved-files>
git cherry-pick --continue
# 4. Push the result
git push origin current-branch
Cherry-Pick Multiple Commits
# Range of commits (oldest..newest, exclusive of oldest)
git cherry-pick abc123^..def456
# Specific commits
git cherry-pick abc123 def456 ghi789
Conflict Resolution
Common Conflict Scenarios
| Scenario | Resolution Strategy | | ------------------------ | ------------------------------- | | Same line edited | Choose one version or combine | | File deleted vs modified | Decide: keep modified or delete | | Rename conflicts | Decide which name to use | | Binary file conflicts | Choose one version explicitly |
Conflict Resolution Steps
# 1. See what's conflicted
git status
# 2. Open conflicted file, look for markers
<<<<<<< HEAD
your changes
=======
their changes
>>>>>>> branch-name
# 3. Edit file to resolve (remove markers, keep correct code)
# 4. Mark as resolved
git add <resolved-file>
# 5. Continue rebase/merge
git rebase --continue
# or
git merge --continue
Conflict Prevention
# Rebase frequently to avoid large conflicts
git fetch origin dev
git rebase origin/dev # Do this daily during long features
# Check for potential conflicts before rebase
git diff origin/dev...HEAD --stat
Recovery Commands
Abort Operations
# Abort rebase
git rebase --abort
# Abort merge
git merge --abort
# Abort cherry-pick
git cherry-pick --abort
Undo Last Commit
# Keep changes staged
git reset --soft HEAD~1
# Keep changes unstaged
git reset HEAD~1
# Discard changes (DANGEROUS)
git reset --hard HEAD~1
Recover Lost Commits
# Find lost commits in reflog
git reflog
# Restore to a specific state
git reset --hard HEAD@{n}
# Cherry-pick a lost commit
git cherry-pick <sha-from-reflog>Safety Guidelines
When to Ask Before Force Push
**ALWAYS ask first if:**
- You've pushed commits that others might have pulled
- You're working on a shared branch
- You're not 100% sure what will happen
- The branch has been open for > 1 week
Safe Force Push Pattern
# 1. Verify you're on correct branch
git branch
# 2. Verify what will be pushed
git log origin/{{TICKET_PREFIX}}-XXX-feature..HEAD --oneline
# 3. Use force-with-lease (protects against overwriting others' work)
git push --force-with-lease origin {{TICKETRead more
name: git-advanced description: Advanced git operations including rebase, bisect, cherry-pick, and conflict resolution. Use when rebasing branches, debugging with bisect, cherry-picking commits, or resolving complex merge conflicts. allowed-tools: Read, Bash, Grep
Git Advanced Skill
Purpose
Provide guidance for advanced git operations with safety considerations. This project uses a **rebase-first workflow** with linear history—understand these patterns to avoid breaking the codebase.
When This Skill Applies
Invoke this skill when:
- Rebasing feature branches onto dev
- Using git bisect to find bugs
- Cherry-picking commits between branches
- Resolving complex merge conflicts
- Recovering from git mistakes
Stop-the-Line Conditions
FORBIDDEN Operations
# FORBIDDEN: Force push to protected branches git push --force origin dev # ❌ NEVER git push --force origin master # ❌ NEVER # FORBIDDEN: Merge commits on dev branch git merge feature-branch # ❌ Use rebase-and-merge PR strategy # FORBIDDEN: Skip pre-commit hooks git commit --no-verify # ❌ Hooks exist for a reason # FORBIDDEN: Rewriting shared history git rebase -i HEAD~5 && git push --force # ❌ If already pushed
SAFE Operations
# SAFE: Force-with-lease on your feature branch
git push --force-with-lease origin {{TICKET_PREFIX}}-XXX-feature # ✅ Safe
# SAFE: Interactive rebase before first push
git rebase -i origin/dev # ✅ Squash/clean local commits
# SAFE: Force push after conflict resolution
git rebase origin/dev && git push --force-with-lease origin {{TICKET_PREFIX}}-XXX-featureRebase Workflow (Standard)
Before Creating PR
# 1. Fetch latest changes
git fetch origin dev
# 2. Rebase onto latest dev
git rebase origin/dev
# 3. If conflicts, resolve them
git status # See conflicted files
# ... edit files to resolve ...
git add <resolved-files>
git rebase --continue
# 4. Push with force-with-lease
git push --force-with-lease origin {{TICKET_PREFIX}}-XXX-featureDuring PR Review (After Feedback)
# 1. Make requested changes
git add . && git commit -m "fix: address PR feedback [{{TICKET_PREFIX}}-XXX]"
# 2. Fetch and rebase again
git fetch origin dev
git rebase origin/dev
# 3. Push update
git push --force-with-lease origin {{TICKET_PREFIX}}-XXX-featureGit Bisect (Finding Bugs)
When to Use
Use bisect when you know a bug was introduced at some point but don't know which commit.
Bisect Workflow
# 1. Start bisect git bisect start # 2. Mark current state (has bug) git bisect bad # 3. Mark a known good commit git bisect good <commit-sha> # e.g., git bisect good abc1234 # 4. Git checks out middle commit - test it yarn test:unit # or manual test # 5. Tell git if this commit is good or bad git bisect good # or git bisect bad # 6. Repeat until found # Git will tell you the first bad commit # 7. End bisect git bisect reset
Automated Bisect
# Run a test script automatically git bisect start HEAD abc1234 git bisect run yarn test:specific-test
Cherry-Pick (Selective Commits)
When to Use
- Backporting a fix to an older branch
- Pulling a specific commit from one branch to another
- Selective feature extraction
Cherry-Pick Workflow
# 1. Find the commit SHA git log --oneline branch-name | head -20 # 2. Cherry-pick to current branch git cherry-pick <commit-sha> # 3. If conflicts, resolve them git status # ... resolve conflicts ... git add <resolved-files> git cherry-pick --continue # 4. Push the result git push origin current-branch
Cherry-Pick Multiple Commits
# Range of commits (oldest..newest, exclusive of oldest) git cherry-pick abc123^..def456 # Specific commits git cherry-pick abc123 def456 ghi789
Conflict Resolution
Common Conflict Scenarios
| Scenario | Resolution Strategy | | ------------------------ | ------------------------------- | | Same line edited | Choose one version or combine | | File deleted vs modified | Decide: keep modified or delete | | Rename conflicts | Decide which name to use | | Binary file conflicts | Choose one version explicitly |
Conflict Resolution Steps
# 1. See what's conflicted git status # 2. Open conflicted file, look for markers <<<<<<< HEAD your changes ======= their changes >>>>>>> branch-name # 3. Edit file to resolve (remove markers, keep correct code) # 4. Mark as resolved git add <resolved-file> # 5. Continue rebase/merge git rebase --continue # or git merge --continue
Conflict Prevention
# Rebase frequently to avoid large conflicts git fetch origin dev git rebase origin/dev # Do this daily during long features # Check for potential conflicts before rebase git diff origin/dev...HEAD --stat
Recovery Commands
Abort Operations
# Abort rebase git rebase --abort # Abort merge git merge --abort # Abort cherry-pick git cherry-pick --abort
Undo Last Commit
# Keep changes staged git reset --soft HEAD~1 # Keep changes unstaged git reset HEAD~1 # Discard changes (DANGEROUS) git reset --hard HEAD~1
Recover Lost Commits
# Find lost commits in reflog
git reflog
# Restore to a specific state
git reset --hard HEAD@{n}
# Cherry-pick a lost commit
git cherry-pick <sha-from-reflog>Safety Guidelines
When to Ask Before Force Push
**ALWAYS ask first if:**
- You've pushed commits that others might have pulled
- You're working on a shared branch
- You're not 100% sure what will happen
- The branch has been open for > 1 week
Safe Force Push Pattern
# 1. Verify you're on correct branch
git branch
# 2. Verify what will be pushed
git log origin/{{TICKET_PREFIX}}-XXX-feature..HEAD --oneline
# 3. Use force-with-lease (protects against overwriting others' work)
git push --force-with-lease origin {{TICKETSAW — SAFe Agentic Workflow AI Agent Harness for Multi-Agent Team Workflows Built on SAFe methodology (Scaled Agile Framework), adapted for AI agent teams (Now With AI-DLC!) Works for any team with repeatable processes: Software, Marketing, Research, Legal, Operations.
Other skills on safe-agentic-workflow.
- /agent-coordination
Agent assignment matrix, blocker escalation, and TDM coordination patterns. Use when assigning work to specialists, managing blockers, or coordinating multi-agent workflows.
Open skill - /api-patterns
API route implementation patterns with RLS, Zod validation, and error handling. Use when creating API routes, implementing endpoints, or adding server-side validation.
Open skill - /confluence-docs
Documentation templates for ADRs, runbooks, and architecture docs. Use when creating architectural decision records, operational runbooks, or technical documentation.
Open skill - /deployment-sop
Deployment workflows, pre-deploy validation, and smoke testing patterns. Use when deploying to staging or production, running smoke tests, or validating deployments.
Open skill - /frontend-patterns
Frontend patterns for Next.js App Router, Clerk auth, shadcn/Radix UI, and PostHog analytics. Use when building UI components, creating pages, implementing auth flows, or adding analytics events. Ensures consistent UX patterns and accessibility standards.
Open skill - /linear-sop
Linear ticket management best practices. Use when creating issues, updating status, or attaching evidence. Provides evidence templates for dev/staging/done phases.
Open skill

