git-advanced
Skill2 starsChanged 3 months agoMITView on GitHub
Use for complex Git operations such as rebases, history rewriting, cherry-picks, conflict recovery, and commit surgery.
- Deletes or force-pushes
- Installs packages
- Commits and pushes
5 other projects use a version of this.
Adopted by
Most recently taken up by
- Kashyap-001/second-brain-templatetheir own version, first seen Jul 23, 2026
- bybren-llc/safe-agentic-workflowtheir own version, first seen Jul 20, 2026
- adyba/pi-safe-workflowtheir own version, first seen Jul 10, 2026
- AgentJDrew/claude-skill-kittheir own version, first seen Jul 6, 2026
- AutumnsGrove/ClaudeSkillstheir own version, first seen Oct 26, 2025
Used with
Projects with it also use safe-workflow, spec-creation and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
adybaSkillsafe-workflow
SAFe Agentic Workflow orchestrator. Teaches the full SAFe methodology adapted for AI agents: pattern discovery, exit states, quality gates, agent personas, and specs-driven development. Use when setting up a project with SAFe workflow, understanding the multi-agent methodology, or coordinating work across agent personas. Triggers: "SAFe workflow", "agent workflow", "safe harness", "specs-driven", "exit states", "quality gates", "multi-agent workflow".
Also in 3 projects that use this
adybaSkillspec-creation
Spec creation with pattern references, acceptance criteria, and demo scripts. Use when creating implementation specs, defining acceptance criteria, breaking down user stories, or translating business requirements to technical specs. Do NOT use for implementation work -- this is for planning and specification only.
Also in 3 projects that use this
LangChainSkilltesting-patterns
Unit testing and integration testing best practices
Also in 3 projects that use this
CloudflareSkillsecurity-audit
Security guidance and vulnerability review for codebases, APIs, services, CLI tools, libraries, and daemons. Use for security questions, focused reviews, vulnerability research, security audits, or pen tests. Run the complete workflow only for explicit codebase audit or pen-test requests, full/comprehensive/end-to-end reviews, or requested report artifacts.
Also in 3 projects that use this
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- bybren-llc/safe-agentic-workflow★ 405same name
- AutumnsGrove/ClaudeSkills★ 30same name
- adyba/pi-safe-workflow★ 0same name
- AgentJDrew/claude-skill-kit★ 0same name
- Kashyap-001/second-brain-template★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository53 other files it gives its agents.
- instructions/AGENTS.mdAGENTS.md
- skills/software-development/php-best-practices/AGENTS.mdAGENTS.md
- instructions/CLAUDE.mdCLAUDE.md
- architecture-designerSkill
- caveman-commitSkill
- caveman-compressSkill
- cavemanSkill
- conventional-commitSkill
- youtube-contentSkill
- agentkit-skill-authoringSkill
- skill-orchestrationSkill
- analogical-thinkingSkill
- investigateSkill
- ponytailSkill
- systematic-debuggingSkill
- mermaid-diagramsSkill
- feature-forgeSkill
- find-skillsSkill
- impeccableSkill
- javascript-proSkill
- legacy-modernizerSkill
- migrationSkill
- no-ai-slopSkill
- olakunlevpn-filament-skillsSkill
- clickupSkill
- clickup-tweak-workflowSkill
- local-wikiSkill
- mr-reviewSkill
- php-proSkill
- doxSkill
- improveSkill
- openspecSkill
- scrutinizeSkill
- systems-thinkingSkill
- tweakSkill
- tweak-workflowSkill
- prompt-engineerSkill
- laravel-best-practicesSkill
- pest-testingSkill
- php-best-practicesSkill
- security-audit-lightSkill
- security-best-practicesSkill
- spatie-javascriptSkill
- spatie-laravel-phpSkill
- spatie-securitySkill
- spatie-version-controlSkill
- tailwindcss-developmentSkill
- test-driven-developmentSkill
- sql-proSkill
- typescript-proSkill
- ui-ux-pro-maxSkill
- vue-expert-jsSkill
- vue-expertSkill
The file
We split this skill into the rules it gives an agent
11 rules. 0 are common, 11 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use advanced commands only on the intended repository and branch.
- Distinctive: line 19
Commit message editing in history
- Distinctive: line 694
Backup Before History Rewriting: Create backup branch before complex operations
- Distinctive: line 695
Never Rewrite Published History: Only rewrite local commits
- Distinctive: line 698
Test After Rebase: Ensure code still works after history changes
- Distinctive: line 699
Prefer Rebase for Local Branches: Keep history linear
- Distinctive: line 701
Sign Important Commits: Use GPG signing for releases
- Distinctive: line 702
Document Complex Operations: Leave comments for future reference
- Distinctive: line 707
Prefer git filter-repo over deprecated git filter-branch.
- Distinctive: line 708
Use git revert for published changes instead of git reset --hard.
- Distinctive: line 709
Create a backup branch before history surgery when recovery matters.
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git Advanced Operations Skill
Use advanced commands only on the intended repository and branch. Confirm destructive or history-rewriting operations before running them, and never rewrite published history without explicit approval.
When to Use
Activate this skill when:
- Performing complex interactive rebases
- Rewriting commit history
- Splitting or combining commits
- Advanced merge strategies
- Cherry-picking across branches
- Commit message editing in history
- Author information changes
- Complex conflict resolution
Interactive Rebase Strategies
Basic Interactive Rebase
# Rebase last 5 commits
git rebase -i HEAD~5
# Rebase from specific commit
git rebase -i abc123^
# Rebase entire branch
git rebase -i mainRebase Commands
# Interactive rebase editor commands:
# p, pick = use commit
# r, reword = use commit, but edit commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like squash, but discard commit message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commitSquashing Commits
# Example: Squash last 3 commits
git rebase -i HEAD~3
# In editor:
pick abc123 feat: add user authentication
squash def456 fix: resolve login bug
squash ghi789 style: format code
# Squash all commits in feature branch
git rebase -i main
# Mark all except first as 'squash'Fixup Workflow
# Create fixup commit automatically
git commit --fixup=abc123
# Autosquash during rebase
git rebase -i --autosquash main
# Set autosquash as default
git config --global rebase.autosquash true
# Example workflow:
git log --oneline -5
# abc123 feat: add authentication
# def456 feat: add authorization
git commit --fixup=abc123
git rebase -i --autosquash HEAD~3Reordering Commits
# Interactive rebase
git rebase -i HEAD~5
# In editor, change order:
pick def456 feat: add database migration
pick abc123 feat: add user model
pick ghi789 feat: add API endpoints
# Reorder by moving lines:
pick abc123 feat: add user model
pick def456 feat: add database migration
pick ghi789 feat: add API endpointsSplitting Commits
# Start interactive rebase
git rebase -i HEAD~3
# Mark commit to split with 'edit'
edit abc123 feat: add user and role features
# When rebase stops:
git reset HEAD^
# Stage and commit parts separately
git add user.go
git commit -m "feat: add user management"
git add role.go
git commit -m "feat: add role management"
# Continue rebase
git rebase --continueEditing Old Commits
# Start interactive rebase
git rebase -i HEAD~5
# Mark commit with 'edit'
edit abc123 feat: add authentication
# When rebase stops, make changes
git add modified-file.go
git commit --amend --no-edit
# Or change commit message
git commit --amend
# Continue rebase
git rebase --continueCommit Surgery
Amending Commits
# Amend last commit (add changes)
git add forgotten-file.go
git commit --amend --no-edit
# Amend commit message
git commit --amend -m "fix: correct typo in feature"
# Amend author information
git commit --amend --author="John Doe <john@example.com>"
# Amend date
git commit --amend --date="2024-03-15 10:30:00"Changing Commit Messages
# Change last commit message
git commit --amend
# Change older commit messages
git rebase -i HEAD~5
# Mark commits with 'reword'
# Change commit message without opening editor
git commit --amend -m "new message" --no-editChanging Multiple Authors
# Filter-branch (legacy method, use filter-repo instead)
git filter-branch --env-filter '
if [ "$GIT_COMMITTER_EMAIL" = "old@example.com" ]; then
export GIT_COMMITTER_NAME="New Name"
export GIT_COMMITTER_EMAIL="new@example.com"
fi
if [ "$GIT_AUTHOR_EMAIL" = "old@example.com" ]; then
export GIT_AUTHOR_NAME="New Name"
export GIT_AUTHOR_EMAIL="new@example.com"
fi
' --tag-name-filter cat -- --branches --tags
# Modern method with git-filter-repo
git filter-repo --email-callback '
return email.replace(b"old@example.com", b"new@example.com")
'Removing Files from History
# Remove file from all history
git filter-branch --tree-filter 'rm -f passwords.txt' HEAD
# Better performance with index-filter
git filter-branch --index-filter 'git rm --cached --ignore-unmatch passwords.txt' HEAD
# Modern method with git-filter-repo (recommended)
git filter-repo --path passwords.txt --invert-paths
# Remove large files
git filter-repo --strip-blobs-bigger-than 10MBFG Repo-Cleaner
# Install BFG
# brew install bfg (macOS)
# apt-get install bfg (Ubuntu)
# Remove files by name
bfg --delete-files passwords.txt
# Remove large files
bfg --strip-blobs-bigger-than 50M
# Replace passwords in history
bfg --replace-text passwords.txt
# After BFG cleanup
git reflog expire --expire=now --all
git gc --prune=now --aggressiveAdvanced Cherry-Picking
Basic Cherry-Pick
# Cherry-pick single commit
git cherry-pick abc123
# Cherry-pick multiple commits
git cherry-pick abc123 def456 ghi789
# Cherry-pick range of commits
git cherry-pick abc123..ghi789
# Cherry-pick without committing (stage only)
git cherry-pick -n abc123Cherry-Pick with Conflicts
# When conflicts occur
git cherry-pick abc123
# CONFLICT: resolve conflicts
# After resolving conflicts
git add resolved-file.go
git cherry-pick --continue
# Or abort cherry-pick
git cherry-pick --abort
# Skip current commit
git cherry-pick --skipCherry-Pick Options
# Edit commit message during cherry-pick
git cherry-pick -e abc123
# Sign-off cherry-picked commit
git cherry-pick -s abc123
# Keep original author date
git cherry-pick --ff abc123
# Apply changes without commit attribution
git cherry-pick -n abc123
git commit --author="New Author <new@example.com>"Mainline Selection for Merge Commits
# Cherry-pick merge commit (specify parent)
git cherry-pick -m 1 abc123
# -m 1 = use first parent (main branch)
# -m 2 = use second parent (merged branch)
# Example workflow:
git log --graph --oneline
# * abc123 Merge pull request #123
# |\
# | * def456 feat: feature commit
# * | ghi789 fix: main branch commit
# To cherry-pick the merge keeping main branch changes:
git cherry-pick -m 1 abc123Advanced Merging
Merge Strategies
# Recursive merge (default)
git merge -s recursive branch-name
# Ours (keep our changes on conflict)
git merge -s ours branch-name
# Theirs (resolve conflicts with their version)
git merge -X theirs branch-name
# Octopus (merge 3+ branches)
git merge -s octopus branch1 branch2 branch3
# Subtree merge
git merge -s subtree branch-nameMerge Strategy Options
# Ours (resolve conflicts with our version)
git merge -X ours branch-name
# Theirs (resolve conflicts with their version)
git merge -X theirs branch-name
# Ignore whitespace
git merge -X ignore-space-change branch-name
git merge -X ignore-all-space branch-name
# Patience algorithm (better conflict detection)
git merge -X patience branch-name
# Renormalize line endings
git merge -X renormalize branch-nameThree-Way Merge
# Standard three-way merge
git merge feature-branch
# With custom merge message
git merge feature-branch -m "Merge feature: add authentication"
# No fast-forward (always create merge commit)
git merge --no-ff feature-branch
# Fast-forward only (fail if merge commit needed)
git merge --ff-only feature-branch
# Squash merge (combine all commits)
git merge --squash feature-branch
git commit -m "feat: add complete authentication system"Advanced Conflict Resolution
Understanding Conflict Markers
[Current Change]
int result = add(a, b);
[Incoming Change]
int sum = calculate(a, b);
[End of Incoming Change]Conflict Resolution Tools
# Use mergetool
git mergetool
# Specify merge tool
git mergetool --tool=vimdiff
git mergetool --tool=meld
git mergetool --tool=kdiff3
# Configure default merge tool
git config --global merge.tool vimdiff
git config --global mergetool.vimdiff.cmd 'vimdiff "$LOCAL" "$MERGED" "$REMOTE"'
# Check out specific version
git checkout --ours file.go # Keep our version
git checkout --theirs file.go # Keep their version
git checkout --merge file.go # Recreate conflict markersRerere (Reuse Recorded Resolution)
# Enable rerere
git config --global rerere.enabled true
# Rerere will automatically resolve previously seen conflicts
git merge feature-branch
# Conflict occurs and is resolved
git add file.go
git commit
# Later, same conflict:
git merge another-branch
# Rerere automatically applies previous resolution
# View rerere cache
git rerere status
git rerere diff
# Clear rerere cache
git rerere forget file.go
git rerere clearInteractive Staging
Partial File Staging
# Interactive staging
git add -p file.go
# Patch commands:
# y - stage this hunk
# n - do not stage this hunk
# q - quit (do not stage this and remaining hunks)
# a - stage this and all remaining hunks
# d - do not stage this and all remaining hunks
# s - split the current hunk into smaller hunks
# e - manually edit the current hunkInteractive Add
# Interactive mode
git add -i
# Commands:
# 1: status - show paths with changes
# 2: update - stage paths
# 3: revert - unstage paths
# 4: add untracked - stage untracked files
# 5: patch - partial staging
# 6: diff - show staged changes
# 7: quit - exitPartial Commits
# Stage part of file interactively
git add -p file.go
# Create commit with partial changes
git commit -m "feat: add validation logic"
# Stage remaining changes
git add file.go
git commit -m "feat: add error handling"Advanced Reset Operations
Reset Modes
# Soft reset (keep changes staged)
git reset --soft HEAD~1
# Mixed reset (keep changes unstaged, default)
git reset --mixed HEAD~1
git reset HEAD~1
# Hard reset (discard all changes)
git reset --hard HEAD~1
# Reset to specific commit
git reset --hard abc123Reset vs Revert
# Reset (rewrites history, use for local changes)
git reset --hard HEAD~3
# Revert (creates new commit, safe for shared history)
git revert HEAD
git revert HEAD~3
git revert abc123..def456Advanced Branch Operations
Branch from Specific Commit
# Create branch from commit
git branch new-branch abc123
git checkout new-branch
# Or in one command
git checkout -b new-branch abc123
# Create branch from remote commit
git checkout -b local-branch origin/remote-branchOrphan Branches
# Create orphan branch (no parent)
git checkout --orphan new-root
git rm -rf .
# Useful for gh-pages, documentation, etc.
echo "# Documentation" > README.md
git add README.md
git commit -m "docs: initialize documentation"Branch Tracking
# Set upstream branch
git branch -u origin/main
# Push and set upstream
git push -u origin feature-branch
# Change upstream
git branch -u origin/develop
# View tracking information
git branch -vvAdvanced Stash Operations
Stash Specific Files
# Stash specific files
git stash push -m "WIP: feature work" file1.go file2.go
# Stash with pathspec
git stash push -p
# Stash untracked files
git stash -u
# Stash including ignored files
git stash -aStash to Branch
# Create branch from stash
git stash branch new-branch stash@{0}
# Creates new branch and applies stash
git stash branch feature-workPartial Stash Application
# Apply specific files from stash
git checkout stash@{0} -- file.go
# Apply stash without dropping
git stash apply stash@{0}
# Apply and drop
git stash pop stash@{0}Submodule Management
Advanced Submodule Operations
# Update submodule to specific commit
cd submodule-dir
git checkout abc123
cd ..
git add submodule-dir
git commit -m "chore: update submodule to version 1.2.3"
# Update all submodules to latest
git submodule update --remote --merge
# Update specific submodule
git submodule update --remote --merge path/to/submodule
# Run command in all submodules
git submodule foreach 'git checkout main'
git submodule foreach 'git pull'
# Clone with submodules at specific depth
git clone --recurse-submodules --depth 1 repo-urlSubmodule to Subtree Migration
# Remove submodule
git submodule deinit path/to/submodule
git rm path/to/submodule
rm -rf .git/modules/path/to/submodule
# Add as subtree
git subtree add --prefix=path/to/submodule \
https://github.com/user/repo.git main --squash
# Update subtree
git subtree pull --prefix=path/to/submodule \
https://github.com/user/repo.git main --squashAdvanced Log and History
Custom Log Formatting
# One-line format with custom fields
git log --pretty=format:"%h - %an, %ar : %s"
# Full custom format
git log --pretty=format:"%C(yellow)%h%C(reset) %C(blue)%ad%C(reset) %C(green)%an%C(reset) %s" --date=short
# Aliases for common formats
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"Finding Lost Commits
# Find commits not in any branch
git log --all --oneline --no-walk --decorate $(git fsck --no-reflog | grep commit | cut -d' ' -f3)
# Find dangling commits
git fsck --lost-found
# Search commit messages
git log --all --grep="search term"
# Find commits by author
git log --author="John Doe"
# Find commits modifying specific code
git log -S "function_name"
git log -G "regex_pattern"Bisect Automation
# Start bisect
git bisect start
git bisect bad HEAD
git bisect good abc123
# Automate bisect with script
git bisect run ./test.sh
# test.sh example:
#!/bin/bash
make && make test
exit $?
# Bisect will automatically find first bad commitBest Practices
- Backup Before History Rewriting: Create backup branch before complex operations
- Never Rewrite Published History: Only rewrite local commits
- Communicate Rebases: Inform team when force-pushing
- Use Descriptive Commit Messages: Even during interactive rebase
- Test After Rebase: Ensure code still works after history changes
- Prefer Rebase for Local Branches: Keep history linear
- Use Merge for Shared Branches: Preserve complete history
- Sign Important Commits: Use GPG signing for releases
- Document Complex Operations: Leave comments for future reference
- Know When to Stop: Sometimes merge commits are clearer than rebased history
Safety Notes
- Prefer
git filter-repoover deprecatedgit filter-branch. - Use
git revertfor published changes instead ofgit reset --hard. - Create a backup branch before history surgery when recovery matters.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

