borhen68/skillengine/git-workflow-and-versioning
Claude Code and agent skill by borhen68/skillengine
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams.
Install
npx vskill@latest install borhen68/skillengine/git-workflow-and-versioningSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as borhen68/skillengine/git-workflow-and-versioning.
Git Workflow and Versioning
Overview
When AI agents generate code at machine speed, version control becomes your only safety mechanism. Without it, a single bad generation can overwrite hours of work irreversibly. With it, every change is a save point you can inspect, revert, or compare.
The git contract: Every meaningful change gets its own commit with a clear message. Branches are short-lived (1-3 days max). History tells a story an engineer can follow. Commits are small enough to review in under 10 minutes. This isn't bureaucracy — it's the difference between confident experimentation and fearful coding.
Real-world impact: DORA research consistently shows trunk-based development correlates with elite engineering performance. Teams that merge small changes frequently have 60% fewer integration failures and recover from incidents 2x faster. Large, long-lived branches are where code goes to die — or worse, to create merge conflicts that take days to resolve.
When to Use
Always. Every code change flows through git.
Core Principles
Trunk-Based Development (Recommended)
Keep main always deployable. Work in short-lived feature branches that merge back within 1-3 days. Long-lived development branches are hidden costs — they diverge, create merge conflicts, and delay integration. DORA research consistently shows trunk-based development correlates with high-performing engineering teams.
This is the recommended default. Teams using gitflow or long-lived branches can adapt the principles (atomic commits, small changes, descriptive messages) to their branching model — the commit discipline matters more than the specific branching strategy.
- Dev branches are costs. Every day a branch lives, it accumulates merge risk.
- Release branches are acceptable. When you need to stabilize a release while main moves forward.
- Feature flags > long branches. Prefer deploying incomplete work behind flags rather than keeping it on a branch for weeks.
1. Commit Early, Commit Often
Each successful increment gets its own commit. Don't accumulate large uncommitted changes.
Commits are save points. If the next change breaks something, you can revert to the last known-good state instantly.
2. Atomic Commits
Each commit does one logical thing:
3. Descriptive Messages
Commit messages explain the why, not just the what:
Format:
Types:
feat— New featurefix— Bug fixrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsdocs— Documentation onlychore— Tooling, dependencies, config
4. Keep Concerns Separate
Don't combine formatting changes with behavior changes. Don't combine refactors with features. Each type of change should be a separate commit — and ideally a separate PR:
Separate refactoring from feature work. A refactoring change and a feature change are two different changes — submit them separately. This makes each change easier to review, revert, and understand in history. Small cleanups (renaming a variable) can be included in a feature commit at reviewer discretion.
5. Size Your Changes
Target ~100 lines per commit/PR. Changes over ~1000 lines should be split. See the splitting strategies in code-review-and-quality for how to break down large changes.
Branching Strategy
Feature Branches
- Branch from
main(or the team's default branch) - Keep branches short-lived (merge within 1-3 days) — long-lived branches are hidden costs
- Delete branches after merge
- Prefer feature flags over long-lived branches for incomplete features
Branch Naming
Working with Worktrees
For parallel AI agent work, use git worktrees to run multiple branches simultaneously:
Benefits:
- Multiple agents can work on different features simultaneously
- No branch switching needed (each directory has its own branch)
- If one experiment fails, delete the worktree — nothing is lost
- Changes are isolated until explicitly merged
The Save Point Pattern
This pattern means you never lose more than one increment of work. If an agent goes off the rails, git reset --hard HEAD takes you back to the last successful state.
Change Summaries
After any modification, provide a structured summary. This makes review easier, documents scope discipline, and surfaces unintended changes:
This pattern catches wrong assumptions early and gives reviewers a clear map of the change. The "DIDN'T TOUCH" section is especially important — it shows you exercised scope discipline and didn't go on an unsolicited renovation.
Pre-Commit Hygiene
Before every commit:
Automate this with git hooks:
Handling Generated Files
- Commit generated files only if the project expects them (e.g.,
package-lock.json, Prisma migrations) - Don't commit build output (
dist/,.next/), environment files (.env), or IDE config (.vscode/settings.jsonunless shared) - Have a `.gitignore` that covers:
node_modules/,dist/,.env,.env.local,*.pem
Using Git for Debugging
Common Rationalizations
| Rationalization | Reality | |
|---|---|---|
| "I'll commit when the feature is done" | One giant commit is impossible to review, debug, or revert. Commit each slice. | |
| "The message doesn't matter" | Messages are documentation. Future you (and future agents) will need to understand what changed and why. | |
| "I'll squash it all later" | Squashing destroys the development narrative. Prefer clean incremental commits from the start. | |
| "Branches add overhead" | Short-lived branches are free and prevent conflicting work from colliding. Long-lived branches are the problem — merge within 1-3 days. | |
| "I'll split this change later" | Large changes are harder to review, riskier to deploy, and harder to revert. Split before submitting, not after. | |
| "I don't need a .gitignore" | Until .env with production secrets gets committed. Set it up immediately. |
Red Flags
- "Fix typo" commits (amend or squash instead)
- Committing broken code "to save progress"
- Force-pushing to shared branches
- Rewriting history on already-merged commits
- Commit messages that describe what changed, not why
- Large uncommitted changes accumulating
- Commit messages like "fix", "update", "misc"
- Formatting changes mixed with behavior changes
- No
.gitignorein the project - Committing
node_modules/,.env, or build artifacts - Long-lived branches that diverge significantly from main
- Force-pushing to shared branches
See Also
Verification
- [ ] Every commit has a descriptive message explaining intent
- [ ] No secrets, passwords, or tokens in commit history
- [ ] Branch history is linear and readable (rebased, not merged messily)
- [ ] Commit diff matches the commit message (no unrelated changes)
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
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/git-workflow-and-versioning/SKILL.md
Popularity
- Repository stars
- 17
- Repository forks
- 4
- 7-day trend score
- 14
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/borhen68/skillengine/git-workflow-and-versioning)