Git Advanced Workflows
SkillAI & modelsgit-advanced-workflows is a skill that guides an AI agent through advanced Git operations. It covers interactive rebase, cherry-picking, bisect, worktrees, and reflog so the agent can clean up commit history, copy commits between branches, find the commit that introduced a bug, work on several branches at once, and recover deleted branches or commits. It also includes safety practices such as force-pushing with lease and creating backup branches before risky operations.
Use Git Advanced Workflows in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Git Advanced Workflows and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the Git Advanced Workflows skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; ahel provides instructions and does not run this skill.
No other account needed.
Have a Git repository with a commit history you want to change or inspect.
What your AI can do with it
- Run interactive rebase to reword, squash, fixup, or drop commits
- Cherry-pick a single commit or a range of commits between branches
- Use git bisect to binary-search for the commit that introduced a bug
- Create and manage worktrees to work on multiple branches at once
- Use reflog to recover deleted branches or lost commits
- Force-push with lease and make backup branches before risky operations
Getting started
- Have a Git repository with a commit history you want to change or inspect.
- Make sure the agent can run Git commands in that repository.
- Ask the agent to use the git-advanced-workflows skill for the specific task, such as cleaning up commits or finding a bug.
- Before any operation that rewrites history, create a backup branch as the skill describes.
- Review the commands the agent proposes before they run, especially force-pushes.
What this skill tells your AI
The instructions your AI receives, as published by wshobson/agents in plugins/developer-essentials/skills/git-advanced-workflows/SKILL.md and read by ahel’s review.
Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.
When to Use This Skill
- Cleaning up commit history before merging
- Applying specific commits across branches
- Finding commits that introduced bugs
- Working on multiple features simultaneously
- Recovering from Git mistakes or lost commits
- Managing complex branch workflows
- Preparing clean PRs for review
- Synchronizing diverged branches
Core Concepts
1. Interactive Rebase
Interactive rebase is the Swiss Army knife of Git history editing.
Common Operations:
pick: Keep commit as-isreword: Change commit messageedit: Amend commit contentsquash: Combine with previous commitfixup: Like squash but discard messagedrop: Remove commit entirely
Basic Usage:
# Rebase last 5 commits
git rebase -i HEAD~5
# Rebase all commits on current branch
git rebase -i $(git merge-base HEAD main)
# Rebase onto specific commit
git rebase -i abc123
2. Cherry-Picking
Apply specific commits from one branch to another without merging entire branches.
# Cherry-pick single commit
git cherry-pick abc123
# Cherry-pick range of commits (exclusive start)
git cherry-pick abc123..def456
# Cherry-pick without committing (stage changes only)
git cherry-pick -n abc123
# Cherry-pick and edit commit message
git cherry-pick -e abc123
3. Git Bisect
Binary search through commit history to find the commit that introduced a bug.
# Start bisect
git bisect start
# Mark current commit as bad
git bisect bad
# Mark known good commit
git bisect good v1.0.0
# Git will checkout middle commit - test it
# Then mark as good or bad
git bisect good # or: git bisect bad
# Continue until bug found
# When done
git bisect reset
Automated Bisect:
# Use script to test automatically
git bisect start HEAD v1.0.0
git bisect run ./test.sh
# test.sh should exit 0 for good, 1-127 (except 125) for bad
4. Worktrees
Work on multiple branches simultaneously without stashing or switching.
# List existing worktrees
git worktree list
# Add new worktree for feature branch
git worktree add ../project-feature feature/new-feature
# Add worktree and create new branch
git worktree add -b bugfix/urgent ../project-hotfix main
# Remove worktree
git worktree remove ../project-feature
# Prune stale worktrees
git worktree prune
5. Reflog
Your safety net - tracks all ref movements, even deleted commits.
# View reflog
git reflog
# View reflog for specific branch
git reflog show feature/branch
# Restore deleted commit
git reflog
# Find commit hash
git checkout abc123
git branch recovered-branch
# Restore deleted branch
git reflog
git branch deleted-branch abc123
Detailed patterns and worked examples
Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.
Best Practices
- Always Use --force-with-lease: Safer than --force, prevents overwriting others' work
- Rebase Only Local Commits: Don't rebase commits that have been pushed and shared
- Descriptive Commit Messages: Future you will thank present you
- Atomic Commits: Each commit should be a single logical change
- Test Before Force Push: Ensure history rewrite didn't break anything
- Keep Reflog Aware: Remember reflog is your safety net for 90 days
- Branch Before Risky Operations: Create backup branch before complex rebases
# Safe force push
git push --force-with-lease origin feature/branch
# Create backup before risky operation
git branch backup-branch
git rebase -i main
# If something goes wrong
git reset --hard backup-branch
Common Pitfalls
- Rebasing Public Branches: Causes history conflicts for collaborators
- Force Pushing Without Lease: Can overwrite teammate's work
- Losing Work in Rebase: Resolve conflicts carefully, test after rebase
- Forgetting Worktree Cleanup: Orphaned worktrees consume disk space
- Not Backing Up Before Experiment: Always create safety branch
- Bisect on Dirty Working Directory: Commit or stash before bisecting
Recovery Commands
# Abort operations in progress
git rebase --abort
git merge --abort
git cherry-pick --abort
git bisect reset
# Restore file to version from specific commit
git restore --source=abc123 path/to/file
# Undo last commit but keep changes
git reset --soft HEAD^
# Undo last commit and discard changes
git reset --hard HEAD^
# Recover deleted branch (within 90 days)
git reflog
git branch recovered-branch abc123
Signals
- GitHub stars
- 40k
- Forks
- 4k
- Last commit
- Sep 2026
ahel review
K4blow
destructive-scopedK4blow
destructive-scoped (in references/details.md)
Automated review, not a security audit. Ruleset v1+k2.
Others that do the same job
Questions
- Can it recover deleted branches or commits?
- Yes. The skill covers reflog, which tracks ref movements including deleted commits, so the agent can find and restore lost work.
- Does it support finding the commit that introduced a bug?
- Yes. It covers git bisect, including automated bisect with a test script, to binary-search through history for the bug-introducing commit.
Advanced
- Item type
- skill
- Key
git-advanced-workflows-wshobson- Source
- github.com/wshobson/agents
More in AI & models
Skill · anthropics
More in AI & modelswayfinder
Skill · mattpocock
More in AI & modelswizard
Skill · mattpocock
More in AI & modelsalgorithmic-art
Skill · anthropics
More in AI & modelscode-review-and-quality
Skill · addyosmani
More in AI & modelsai-first-engineering
Skill · affaan-m
More in AI & models