/git-tools:git-advancedfrom git-tools
Advanced git operations (rebase, cherry-pick, reflog, stash, reset, clean), analysis tools (bisect, blame, history), and command reference. Use for complex git tasks, recovery operations, or when user mentions rebase, cherry-pick, reflog, stash, reset, bisect, or needs git command reference.
Ships in git-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Expert guidance for advanced git operations, history analysis, recovery, and command reference.
git statusgit branch --show-currentgit log --oneline -10git reflog -10git branch -aModify commits: reorder, edit, squash, drop, or reword.
Basic usage:
# Rebase last 3 commits
git rebase -i HEAD~3
# Rebase since branching from main
git rebase -i main
Interactive commands:
pick abc1234 Add user authentication
reword def5678 Fix typo in login # Edit message
squash ghi9012 Add password validation # Combine with previous
drop jkl3456 Debug logging # Remove commit
# p/pick, r/reword, e/edit, s/squash, f/fixup, d/drop
Example - Squash last 3 commits:
git rebase -i HEAD~3
# Change last 2 "pick" to "squash", save, edit combined message
Safety:
git rebase --abort if things go wrongFor detailed examples, see advanced-operations.md.
Apply specific commits from one branch to another.
Basic usage:
# Apply single commit
git cherry-pick <commit-hash>
# Apply multiple commits
git cherry-pick <commit1> <commit2>
# Apply range of commits
git cherry-pick <commit1>^..<commit2>
Handle conflicts:
git status # Identify conflicts
# Edit and resolve conflicts
git add <resolved-files>
git cherry-pick --continue # Or: git cherry-pick --abort
Use cases: Apply bug fix across branches, port features, extract specific commits.
For detailed examples, see advanced-operations.md.
Your safety net - tracks all ref updates (commits, resets, checkouts, etc.).
Basic usage:
# View reflog
git reflog
# View reflog for specific branch
git reflog show feature-branch
Recover lost commit:
git reflog # Find lost commit (e.g., HEAD@{2})
git cherry-pick HEAD@{2} # Recover it
# Or: git branch recovered HEAD@{2}
Reflog is your recovery tool for undoing resets, recovering deleted branches, and finding lost commits. See Common Recovery Scenarios below.
Save uncommitted changes temporarily without committing.
Basic usage:
git stash # Stash all changes
git stash save "WIP: User auth" # Stash with message
git stash list # List stashes
git stash pop # Apply and remove stash
git stash apply stash@{2} # Apply specific stash
Advanced:
git stash -u # Include untracked files
git stash --keep-index # Stash only unstaged changes
git stash branch new-branch-name # Create branch from stash
git stash drop stash@{1} # Drop specific stash
Use cases: Switch branches with uncommitted work, try experimental changes, clean working directory temporarily.
For detailed examples, see advanced-operations.md.
Move branch pointer and optionally modify staging area and working directory.
Reset modes:
git reset --soft HEAD~1 # Move HEAD, keep changes staged
git reset HEAD~1 # Move HEAD, unstage changes, keep in working dir (default)
git reset --hard HEAD~1 # Move HEAD, discard all changes
Common use cases:
git reset --soft HEAD~1 # Undo last commit, keep changes staged
git reset # Unstage all files
git reset --hard HEAD # Discard all local changes
git reset --hard <commit> # Move branch to specific commit
Safety:
--hard discards work permanently (unless you use reflog)For detailed examples, see advanced-operations.md.
Remove untracked files from working directory.
Basic usage:
git clean -n # Dry run (see what would be deleted)
git clean -f # Delete untracked files
git clean -fd # Delete untracked files and directories
git clean -fdx # Include ignored files
Safety:
-n (dry run) first-x (deletes ignored files like dependencies)Binary search to find commit that introduced a bug.
Basic workflow:
git bisect start
git bisect bad # Mark current as bad
git bisect good <commit-hash> # Mark known good commit
# Git checks out middle commit - test the code
git bisect good # Or: git bisect bad
# Repeat until bug found
git bisect reset # End bisect
Automated bisect:
git bisect start HEAD v1.0
git bisect run ./test_script.sh # Script exits 0 if good, non-zero if bad
For detailed examples, see advanced-operations.md.
Modify the last commit.
Basic usage:
git commit --amend -m "New message" # Modify message
git add forgotten-file.txt # Add more changes
git commit --amend --no-edit # Amend without changing message
Safety:
See who last modified each line of a file.
Basic usage:
git blame <file> # Blame entire file
git blame -L 10,20 <file> # Blame specific lines
git blame -e <file> # Show email instead of name
git blame -w <file> # Ignore whitespace changes
Use cases: Find who to ask about code, understand when/why code changed, track down bug introduction.
Find commits by various criteria.
Search commit messages:
git log --grep="bug fix" # Search messages
git log --grep="bug fix" -i # Case insensitive
git log --grep="bug" --grep="fix" --all-match # Multiple patterns
Search code content:
git log -S "function_name" # Added/removed text
git log -G "regex_pattern" # Regex pattern
git log -p -S "function_name" # Show patches
Filter by author/date:
git log --author="John Doe" # By author
git log --since="2 weeks ago" # By date
git log --after="2024-01-01" --before="2024-02-01" # Date range
git log --author="John" --since="1 month ago" --grep="fix" # Combined
For detailed examples, see advanced-operations.md.
Use reflog to recover from mistakes:
Recover lost commit:
git reflog # Find lost commit
git cherry-pick HEAD@{5} # Or: git branch recovered HEAD@{5}
Undo accidental reset:
git reflog # Find previous HEAD
git reset --hard HEAD@{1} # Reset back
Restore deleted branch:
git reflog # Find last commit on deleted branch
git branch recovered-branch <commit-hash>
Step-by-step recovery:
git refloggit show HEAD@{5}git cherry-pick HEAD@{5} or git reset --hard HEAD@{5} or git branch recovered HEAD@{5}For detailed recovery procedures, see advanced-operations.md.
Before risky operations:
git branch backup-$(date +%Y%m%d) # Create backup branch
git reflog # Verify reflog is working
git clean -n # Dry run for clean operations
Golden rules:
--force-with-lease instead of --forceSee references/common-commands.md for complete command reference including basic operations, branching, merging, remote operations, inspection, and all flags.
See references/advanced-operations.md for in-depth examples, advanced scenarios, troubleshooting guides, and complete coverage of all operations.
@git-commits@git-stacked-prsMost used advanced commands:
git reflog # View history (recovery)
git stash # Save work temporarily
git rebase -i HEAD~3 # Interactive rebase
git cherry-pick <commit> # Apply specific commit
git reset --soft HEAD~1 # Undo commit, keep changes
git bisect start # Find bug-introducing commit
git clean -n # Dry run cleanup
git commit --amend # Modify last commit
git log --grep="pattern" # Search history
git blame <file> # See who changed lines
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nilpath/nilpath-marketplace --plugin git-tools6 skills in this plugin
/gh-address-commentsAddress review/issue comments on the open GitHub PR for the current branch. Fetches all comments and review threads, summarizes what needs attention, and helps apply fixes. Use when responding to PR feedback, resolving review comments, or when user mentions "address comments" or "fix review feedback"./gh-pr-reviewGitHub PR review operations via gh CLI. Create pending reviews with line comments, submit reviews (approve/reject/comment). Use when adding PR comments, submitting reviews, or managing GitHub code reviews./git-commitsGit commit best practices and message formatting guidelines. Use when creating commits, improving commit messages, learning commit conventions, or when user mentions commit messages, commit formatting, or commit guidelines.