Git mastery

From softspark/ai-toolkit · View interactive version

Git mastery is an AI agent skill from the GitHub repository softspark/ai-toolkit. Advanced Git: rebase, bisect, reflog, cherry-pick, worktrees, LFS. Triggers: rebase, bisect, cherry-pick, reflog, force push, merge conflict, worktree.

How to use this skill

Skill file

Git Mastery Skill

🛡️ Safety First Protocol

git branch backup/feature-xyz-pre-rebase

Advanced Workflows

1. Automated Bug Hunting (Git Bisect)

Find the specific commit that introduced a bug.

# Start
git bisect start
git bisect bad              # Current version is broken
git bisect good <commit-sha> # Version that worked

# Automate with test script
git bisect run pytest tests/test_failing_feature.py

2. Interactive Interactive Rebase

Clean up commit history before merge.

git rebase -i HEAD~n

3. Log Analysis

Visualize branch topology.

git log --graph --oneline --decorate --all

4. Recovery (Reflog)

Recover "lost" commits after a bad reset/rebase.

git reflog
git reset --hard HEAD@{n}

5. Cherry Picking

Pick specific commits from other branches.

git cherry-pick <commit-sha>
# If valid conflict
git add .
git cherry-pick --continue

Commit Message Standard (Conventional Commits)

Common Rationalizations

| Excuse | Why It's Wrong |

|--------|----------------|

| "I'll clean up commits later" | Later means never — write clean commits as you go |

| "Force push is fine on my branch" | Others may have fetched your branch — use --force-with-lease |

| "One big commit is simpler" | Big commits are impossible to review, bisect, or revert — keep them atomic |

| "Merge conflicts mean someone else's problem" | Conflicts mean you diverged too long — rebase frequently to stay aligned |

| "Commit messages don't matter" | Messages are documentation — future you needs to understand why, not just what |

Rules

Gotchas

When NOT to Load

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.