git-workflow-and-versioning
What it does
This guide teaches you how to organize your programming work using Git, a version control system. It helps you save your progress at 'save points' (commits), work in separate 'sandboxes' (branches), and maintain a clear history of what has been done.
When to use it
- βWhen starting work on a new feature.
- βWhen making small code changes.
- βWhen you need to organize work from multiple people or multiple tasks simultaneously.
Skill link
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/git-workflow-and-versioning/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βHow should I save my code progress so I can go back if something goes wrong?β
5 new skills a week. 1 minute to read.
How it works
Git allows you to save your work in stages (commits). Each commit is like a save point. If you make a mistake, you can easily revert to a previous commit. Working in 'branches' allows you to create separate versions of your code to experiment or work on different features without affecting the main code.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Git Workflow and Versioning
Overview
Git is your safety net. Treat commits as save points, branches as sandboxes, and history as documentation. With AI agents generating code at high speed, disciplined version control is the mechanism that keeps changes manageable, reviewable, and reversible.
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.
main βββββββββββββββββββββββββββββ (always deployable)
β² β± β² β±
ββββββ± ββββ± β short-lived feature branches (1-3 days)
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.
Work pattern:
Implement slice β Test β Verify β Commit β Next slice
Not this:
Implement everything β Hope it works β Giant commit
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:
# Good: Each commit is self-contained
git log --oneline
a1b2c3d Add task creation endpoint with validation
d4e5f6g Add task creation form component
h7i8j9k Connect form to API and add loading state
m1n2o3p Add task creation tests (unit + integration)
# Bad: Everything mixed together
git log --oneline
x1y2z3a Add task feature, fix sidebar, update deps, refactor utils
3. Descriptive Messages
Commit messages explain the why, not just the what:
# Good: Explains intent
feat: add email validation to registration endpoint
Prevents invalid email formats from reaching the database.
Uses Zod schema validation at the route handler level,
consistent with existing validation patterns in auth.ts.
# Bad: Describes what's obvious from the diff
update auth.ts
Format:
<type>: <short description>
<optional body explaining why, not what>
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:
# Good: Separate concerns
git commit -m "refactor: extract validation logic to shared utility"
git commit -m "feat: add phone number validation to registration"
# Bad: Mixed concerns
git commit -m "refactor validation and add phone number field"
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.
~100 lines β Easy to review, easy to revert
~300 lines β Acceptable for a single logical change
~1000 lines β Split into smaller changes
Branching Strategy
Feature Branches
main (always deployable)
β
βββ feature/task-creation β One feature per branch
βββ feature/user-settings β Parallel work
βββ fix/duplicate-tasks β Bug fixes
- Branch from
main(or the team's default branch)
β¦
FAQ
What is a 'commit'?
A commit is a 'save point' for your code. It records the changes you've made at a specific time. It's like saving your game.
What is a 'branch'?
A branch is like a separate copy of your code where you can work on new features or fix bugs without affecting the main version. You can then merge these changes back.
Why should I make small, frequent commits?
Making small, frequent commits makes it easier to track what changed, understand the history, and revert to a previous version if something goes wrong. It's like saving your game often instead of just at the end.
Details
Original description by the author
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.
Popularity
- GitHub stars
- 48k
- Ranking position
- #4741
- License
- MIT
- Updated
- 10/15/2026
Comments
- β¦
More skills from this repository
00-andruia-consultant
48kHelps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
007
48kLets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
10-andruia-skill-smith
48kHelps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
20-andruia-niche-intelligence
48kLets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
Similar skills
openclaw-update
394kHelps your agent update an existing OpenClaw Gateway, choosing the update method that fits how it was installed and keeping your session working.
diagnose-gateway
394kHelps your agent find out why your OpenClaw Gateway is failing by checking settings, channels, and ports without changing anything.
crabbox-apps
394kHelps your agent open and run an app on a temporary cloud machine, then show its view in your chat side panel.