What It Does
Whether you're onboarding to a new codebase or navigating a tricky merge conflict, this skill gives your agent the precise command syntax and workflow context to help you move faster.
Git Essentials is a skill that brings a curated, comprehensive reference of Git commands and workflows directly to your AI agent. It covers everything from initial repository setup and daily staging/committing routines to advanced operations like interactive rebasing, cherry-picking, submodules, and fork syncing.
Key Features
- Full Branching & Merging Reference — Covers creating, switching, renaming, and deleting branches using both classic (`checkout`) and modern (`switch`) syntax. Includes merge strategies, no-fast-forward merges, conflict detection, and merge abort procedures.
- Undo & Recovery Patterns — Provides clear, safe patterns for undoing changes at every stage — working directory, staging area, and committed history. Includes `git reset`, `git revert`, `git restore`, `git reflog`, and deleted-branch recovery.
- Remote & Sync Operations — Covers adding and managing remotes, fetching, pulling (with and without rebase), pushing new branches, and safe force-pushing with `--force-with-lease`. Includes a complete fork-sync workflow.
- Stashing & Rebasing — Full stash lifecycle commands (save, list, apply, pop, drop) and rebase workflows including interactive rebase for cleaning up commit history, conflict resolution steps, and abort procedures.
- History Search & Inspection — Includes `git log` with filtering by author, date range, message, and code content (`-S`). Also covers `git blame` for line-level attribution and `git bisect` for bug hunting across commit history.
- Common Workflows & Aliases — Provides end-to-end command sequences for feature branch, hotfix, and fork-sync workflows. Also includes a set of practical `~/.gitconfig` aliases to speed up everyday Git usage.
Use Cases
- Feature branch development — A developer asks their agent to walk through creating a feature branch, staging changes, committing with a meaningful message, and pushing for a pull request — all using the correct Git syntax for their team's workflow.
- Recovering from a bad commit — After accidentally committing sensitive data or a broken change to the wrong branch, a user asks the agent for the safest way to undo it. The skill provides `reset --soft`, `revert`, or `reflog`-based recovery depending on whether the commit has been pushed.
- Syncing a forked repository — An open-source contributor needs to bring their fork up to date with the upstream repository. The agent uses the skill's fork-sync workflow to add the upstream remote, fetch, merge, and push in the correct order.
- Cleaning up commit history before merging — Before opening a pull request, a developer wants to squash and reorder their last several commits. The agent guides them through `git rebase -i HEAD~N` interactively, including how to continue or abort if conflicts arise.