git-workflow
Skill3 starsChanged 4 months agoMITView on GitHub
Use when committing, branching, resolving merge or rebase conflicts, or setting up git guardrails and pre-commit hooks — resolves conflicts by intent traced to each side's source, never --abort. Triggers on "commit", "merge conflict", "rebase", "pre-commit", "提交", "合并冲突", "分支管理".
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
118 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- Lukk17/agent-standardstheir own version, first seen Oct 5, 2026
- JameMy0001/antigravity-skills-hubtheir own version, first seen Oct 2, 2026
- NinjaSln-labs/agent-skillstheir own version, first seen Oct 2, 2026
- 1pedroosilva/databricks-genie-skillstheir own version, first seen Oct 2, 2026
- vospr/context-engineering-templatetheir own version, first seen Oct 1, 2026
- fusebase-dev/fusebase-flowtheir own version, first seen Oct 1, 2026
Used with
Projects with it also use squad-commands, typescript-patterns and 8 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.
MicrosoftSkillsquad-commands
Categorized catalog of common Squad operations. Coordinator reads this file and presents it as an interactive menu when the user asks for available commands or help.
Also in 3 projects that use this
cohen-lielSkilltypescript-patterns
TypeScript best practices and patterns. Use when writing TypeScript code, defining types, working with generics, or converting JavaScript to TypeScript.
Also in 4 projects that use this
martinholovskySkillllm-integration
Expert skill for integrating local Large Language Models using llama.cpp and Ollama. Covers secure model loading, inference optimization, prompt handling, and protection against LLM-specific vulnerabilities including prompt injection, model theft, and denial of service attacks.
Also in 4 projects that use this
YepAPISkillbackground-jobs
Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.
Also in 3 projects that use this
Vimalk0703Skilldependency-management
Vet packages before adoption, audit for vulnerabilities, pin versions, and prevent dependency bloat.
Also in 3 projects that use this
pluginagentmarketplaceSkillmicroservices
Microservices architecture patterns and best practices. Service decomposition, inter-service communication, and distributed data management.
Also in 3 projects that use this
Other versions118 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- byshahriar/skill-forge★ 012% same
Wrote their own version · 117
- JetBrains/ideavim★ 10ksame name
- Galaxy-Dawn/claude-scholar★ 5.7ksame name
- github/gh-aw★ 5.3ksame name
- microsoft/Generative-AI-for-beginners-dotnet★ 3.1ksame name
- microsoft/waza★ 1.4ksame name
- laolaoshiren/claude-code-skills-zh★ 876same name
- Mindrally/skills★ 266same name
- Azure/fleet★ 226same name
- povvo/claudikins-kernel★ 128same name
- extra-org/extra★ 113same name
107 more not listed
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 repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- brainstormSkill
- oss-strategySkill
- specSkill
- researchSkill
- api-designSkill
- architectureSkill
- codebase-designSkill
- design-researchSkill
- domain-modelingSkill
- frontend-designSkill
- imagegenSkill
- image-to-codeSkill
- prompt-engineeringSkill
- prototypeSkill
- schema-designSkill
- auth-implementationSkill
- breakdownSkill
- context-engineeringSkill
- error-handlingSkill
- i18nSkill
- implementSkill
- multi-agent-orchestrationSkill
- cost-optimizationSkill
- performanceSkill
- refactoringSkill
- simplifySkill
- api-testingSkill
- e2e-testingSkill
- load-testingSkill
- tddSkill
- test-generationSkill
- a11y-reviewSkill
- code-reviewSkill
- debuggingSkill
- lintingSkill
- security-reviewSkill
- ci-cdSkill
- deprecation-migrationSkill
- oss-polishSkill
- shippingSkill
- documentation-auditSkill
- handoffSkill
- incident-responseSkill
- observabilitySkill
- purity-auditSkill
- skill-authoringSkill
- using-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 101 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 23
Keep main always deployable.
- Distinctive: line 67
Don't combine formatting changes with behavior changes, or refactors with features.
- Very specific: line 83
When a merge or rebase conflicts, never --abort.
- Distinctive: line 86
Find the primary source for each conflict: Read the commit messages, the PRs, the original issues/tickets.
“Common” is measured: kept by at least 6 in 10 of the 101 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 Workflow and Versioning
Git is your safety net: commits are save points, branches are sandboxes, history is documentation. With AI agents generating code at high speed, disciplined version control is what keeps changes manageable, reviewable, and reversible.
When to use
- Committing, branching, or organizing work across parallel streams.
- Resolving an in-progress merge or rebase conflict.
- Cutting a release, choosing a semantic version bump, tagging, or writing a changelog.
- Setting up git guardrails (blocking dangerous commands) or pre-commit hooks.
Not for: a simple commit of finished work with no conflicts (just commit it); designing CI pipelines (use ci-cd); production deployment strategy (use shipping).
Steps
1. Work trunk-based with short-lived branches
Keep main always deployable. Work in short-lived feature branches that merge back within 1–3 days. Long-lived branches are a hidden cost — they diverge, create merge conflicts, and delay integration. DORA research consistently links trunk-based development with high-performing teams.
main ──●──●──●──●──●──●──●──●──●── (always deployable)
╲ ╱ ╲ ╱
●──●─╱ ●──╱ ← short-lived feature branches (1-3 days)Branch naming: feature/<desc>, fix/<desc>, chore/<desc>, refactor/<desc>. Delete branches after merge. Prefer feature flags over long-lived branches for incomplete features.
For parallel AI-agent work, use git worktrees so each agent works in its own directory with its own branch — no branch switching, no interference:
git worktree add ../project-feature-a feature/task-creation
# ...later
git worktree remove ../project-feature-a2. Commit early, atomic, descriptive
Each successful increment gets its own commit (implement slice → test → verify → commit). If the next change breaks something, you can revert to the last known-good state instantly.
Atomic — each commit does one logical thing:
# Good: self-contained
feat: add task creation endpoint with validation
feat: add task creation form component
test: add task creation tests (unit + integration)
# Bad: mixed
feat: add task feature, fix sidebar, update deps, refactor utilsDescriptive — messages explain the why, not just the what:
<type>: <short description>
<optional body explaining why, not what>Types: feat, fix, refactor, test, docs, chore.
Don't combine formatting changes with behavior changes, or refactors with features. Each is a separate commit (and ideally a separate PR). Target ~100 lines per commit/PR; changes over ~1000 lines should be split.
3. Pre-commit hygiene
Before every commit:
git diff --staged # see what you're committing
git diff --staged | grep -iE 'password|secret|api_key|token' # no secrets
npm test && npm run lint && npx tsc --noEmit # gates passAutomate with Husky + lint-staged. See references/pre-commit-setup.md for the full setup (package-manager detection, hook script, Prettier config).
4. Resolve merge conflicts hunk-by-hunk, by intent
When a merge or rebase conflicts, never --abort. Resolve by tracing each side's intent back to its source.
- See the current state. Inspect git history and the conflicting files.
- Find the primary source for each conflict. Read the commit messages, the PRs, the original issues/tickets. Understand deeply why each change was made — what intent does it encode?
- Resolve each hunk. Preserve both intents where possible. Where they're incompatible, pick the one matching the merge's stated goal and note the trade-off. Do not invent new behaviour.
- Run the project's automated checks — typecheck, then tests, then format. Fix anything the merge broke.
- Finish the merge/rebase. Stage everything and commit. If rebasing, continue until all commits are rebased.
5. Block dangerous git commands
Install a PreToolUse hook that intercepts and blocks destructive git commands before Claude executes them: git push (including --force), git reset --hard, git clean -f[d], git branch -D, git checkout . / git restore .. The hook script is at references/block-dangerous-git.sh — copy it to .claude/hooks/ (project) or ~/.claude/hooks/ (global), chmod +x, and register it in settings.json under hooks.PreToolUse with matcher Bash. The full settings.json wiring (project + global) and a verify snippet are in references/block-dangerous-git-setup.md.
6. Handle generated files correctly
- Commit generated files the project expects tracked (
package-lock.json, Prisma migrations). - Don't commit build output (
dist/,.next/), env files (.env), or IDE config unless shared. - Maintain a
.gitignorecoveringnode_modules/,dist/,.env,.env.local,*.pem.
7. Use git for debugging
git bisect, log, diff, blame, and log --grep for locating regressions and tracing history — see references/git-debugging.md.
8. Version, tag, and changelog for anything with consumers
A version is how consumers track change. The moment anything else depends on your code — another team, a published package, a deployed client — "latest on main" stops being a sufficient answer.
Tag the release; let the tag be the source of truth. A release is an immutable point in history, not a moving branch. Semantic versioning (MAJOR.MINOR.PATCH), the tag commands, and the changelog format (grouped by Added / Changed / Fixed / Deprecated / Removed / Security, newest on top, phrased around user impact) — see references/versioning.md. Write the changelog entry in the same change that makes the change; breaking changes get a migration note and a deprecation window (see the deprecation-migration skill).
Verify
For every commit:
- Commit does one logical thing
- Message explains the why; follows type conventions
- Tests pass before committing
- No secrets in the diff
- No formatting-only changes mixed with behavior changes
.gitignorecovers standard exclusions
For every merge/rebase conflict:
- Each hunk's intent traced to its source (commit/PR/issue)
- Both intents preserved where possible; trade-offs noted where not
- Typecheck, tests, and format all pass after resolution
For every release (anything with consumers):
- The version bump matches the change: breaking → major, additive → minor, fix → patch
- The release is tagged, and the version is derived from the tag
- The changelog has a curated, human-readable entry grouped by impact for this version
References
- ${CLAUDE_PLUGIN_ROOT}/references/engineering-principles.md — shared discipline (verify don't assume, surgical scope, simplicity)
- references/block-dangerous-git.sh — PreToolUse hook blocking
git push,reset --hard,clean -f,branch -D, etc. - references/block-dangerous-git-setup.md — settings.json wiring (project + global) for the block-dangerous-git hook
- references/pre-commit-setup.md — Husky + lint-staged + Prettier pre-commit hook setup
- references/git-debugging.md — bisect/log/diff/blame commands for tracing regressions
- references/versioning.md — semver definitions, tag commands, changelog format
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

