Guides safe Git usage with atomic commits, clear messages, branching, rebase vs merge, conflict resolution, PR descriptions, and recovery from mistakes like lost commits, bad merges, or committed secrets.
Ships in engineering-core. 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.
History is shared infrastructure. Keep commits small and explainable, never rewrite history other people have pulled, and know how you will get back (the reflog, a backup branch) before running anything destructive.
Stop and get explicit confirmation from the user before running any of these. Say exactly what could be lost.
| Command | Risk |
|---|---|
git push --force / --force-with-lease | Rewrites the remote branch; others' commits can be lost |
git reset --hard | Permanently discards uncommitted changes |
git clean -fd (or -fdx) | Permanently deletes untracked (and ignored) files |
git restore <path> / git checkout -- <path> | Permanently discards uncommitted changes in those files |
git branch -D / git push origin --delete <branch> | Deletes a branch; the remote one may be unrecoverable for you |
git stash drop / git stash clear | Removes stash entries (recovery is possible but awkward) |
git rebase on a branch others use | Rewrites shared history |
git filter-repo or any history rewrite | Changes every affected commit ID; all clones must be reset |
Before a risky operation:
git status and git stash list and read the output.git branch backup/before-rebase (any clear name).--force-with-lease over --force, git reset --keep over --hard, git revert over rewriting pushed history.Also: never skip hooks with --no-verify unless the user asks, and never push, open pull requests or delete remote branches unless the user asked for it.
git bisect and git revert work cleanly.git add src/orders/refund.ts tests/refund.test.ts. Avoid git add . / git add -A unless you have read git status and every change belongs in the commit. (git add -p stages parts of files but is interactive; use it only in an interactive terminal.)git diff --cached. Look for secrets, debug output, generated files and unrelated changes.<summary: imperative mood, about 50 chars, at most 72>
<body: what changed and why, not how. Wrap at 72. Mention
trade-offs, alternatives rejected, and anything surprising.>
<footer: Refs #123, Co-authored-by: ..., BREAKING CHANGE: ...>
git log --oneline -20 and any commitlint or contributing config. If the project uses Conventional Commits, use its types: feat, fix, docs, refactor, perf, test, build, ci, chore, with ! or a BREAKING CHANGE: footer for breaking changes..gitignore covers them.| Model | Fits | Rules |
|---|---|---|
| Trunk-based (short-lived branches, feature flags) | Continuous delivery, most product teams | Branches live hours to a couple of days; main is always releasable; unfinished work hides behind flags |
| Feature branch + pull request to main (GitHub flow) | Most web and service projects | Same as above, with review on every PR; deploy from main |
| Release branches (and Gitflow-style models) | Several supported versions, scheduled releases, mobile or on-premises software | Fixes land on main and are cherry-picked to release branches (or the reverse, consistently); more merge overhead |
Name branches the way the repository already does (for example feat/refund-retries, fix/1234-null-org).
| Situation | Do this |
|---|---|
| Update your own, unshared feature branch with main | git fetch origin then git rebase origin/main (or git merge origin/main if the team prefers merge commits) |
| The branch is shared or others build on it | Merge (git merge origin/main); do not rebase |
| Tidy your own commits before review | Make fixup commits with git commit --fixup <sha>, then GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash origin/main (the empty editor accepts the generated plan non-interactively). Or git reset --soft origin/main and recommit in clean steps. |
| Push after rebasing your own branch | git push --force-with-lease --force-if-includes (Git 2.30+), after confirmation |
| Integrate a PR into main | Use the repository's setting: squash merge, rebase merge or merge commit. Do not change it per PR without agreement. |
--force-with-lease refuses to overwrite the remote branch if it moved since your last fetch. A background fetch (from an editor, for example) can defeat it, which is what --force-if-includes guards against.
git status lists the conflicted files.git diff shows the conflict hunks.git log --merge -p -- <file> shows the commits on each side that touched the file.git diff --check reports leftover markers and whitespace errors.package-lock.json, pnpm-lock.yaml, poetry.lock, Cargo.lock, ...): do not hand-merge. Take one side, then rerun the package manager so it regenerates the lockfile from the merged manifest.git add <file>, then git rebase --continue or git merge --continue. To back out completely: git rebase --abort or git merge --abort.For conflicts that keep recurring (long-running branches, repeated rebases), enable git config rerere.enabled true so Git reuses recorded resolutions.
Self-review the full diff first (git diff origin/main...HEAD). Keep PRs small: under about 400 lines of logic is reviewable in one sitting. Then describe it:
## What
One or two sentences on the change.
## Why
The problem, with a link to the issue.
## How
Notable decisions and alternatives considered.
## Testing
Commands run, manual steps, screenshots or recordings for UI changes.
## Risk and rollout
Migrations, feature flags, backward compatibility, how to roll back.
git lfs track "*.psd", then commit .gitattributes) or an artifact store.git rev-list --objects --all \
| git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' \
| awk '$1 == "blob"' | sort -k3 -n | tail -20
.gitignore, and amend or redo the commit (git reset --soft HEAD~1, fix, recommit).git filter-repo (not git filter-branch). This needs a force-push and every collaborator must re-clone or reset. Hosting platforms may keep old commits reachable (pull request refs, caches); their support or docs describe how to purge them. Recipes are in references/recovery-recipes.md.git add . without reading git status, committing .env files and build output.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
git-workflow, commit-messages, branching, rebase, merge-conflicts, git-recovery
/engineering-core:git-workflowfrom engineering-core
npx claudepluginhub reddygopalkrishna/developer-agent-skills --plugin engineering-core14 skills in this plugin
/codebase-onboardingMaps an unfamiliar repository before changing it - stack, build/test/run commands, entry points, data flow, conventions and how changes ship - and writes a short map. Use when starting work in a repo you have not seen, when asked to explain how a codebase works, onboard to a project, find where something lives, or before a first change in a large or legacy codebase. Not for reviewing a specific diff./code-review-changesReviews code changes (a pull request, merge request or diff) like a senior engineer - finds real bugs, security holes, data risks and breaking changes, verifies each one, and reports it with file:line, a concrete failure scenario and a suggested fix. Use when asked to review a PR, merge request, diff, branch, staged changes or patch, or to check code before merging. Also covers responding to review comments on your own PR./dependency-upgradesOther plugins' skills for the same job