/google-engineering:git-workflowfrom google-engineering
Industry-standard version control — atomic commits, commit message anatomy, Conventional Commits, git trailers, branching models, rebase vs merge, PR hygiene, SemVer, changelogs, tags, signing, and history-recovery. Use before writing any commit message, when splitting work into commits, when choosing a branch strategy or merge method, when versioning or releasing, when a rebase/merge/force-push decision comes up, or when history needs repairing. Carries the Conventional Commits, SemVer, and Keep a Changelog specs in references/.
Ships in google-engineering. 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.
Version control has one job: make the history of a project answerable. Every rule below serves a question someone will ask later — what changed, why, when did this break, can I safely undo it.
Pair with google-cl-author for how large a change should be and how to survive review. This skill covers the mechanics.
One commit = one logical, self-contained change. It builds, it passes tests, and reverting it removes exactly one thing. This is what makes bisect, revert, cherry-pick, and blame archaeology work; a repo of "wip" commits has none of those tools available.
Staging tools for splitting work you've already written: git add -p for hunks, git stash -k to test only what's staged, git commit --fixup <sha> + git rebase -i --autosquash to fold a fix into the commit it belongs to.
The near-universal convention, from the Linux kernel through GitHub tooling:
<subject: max 50 chars, imperative mood, no trailing period>
<blank line>
<body: wrapped at 72 chars, explains WHY>
<blank line>
<trailers: Key: value>
Subject line. Imperative mood — "Add retry to the upload client", not "Added" / "Adding" / "Adds". The test: the subject should complete the sentence "If applied, this commit will ___." Capitalize the first word, no period. 50 characters is the target so it isn't truncated in git log --oneline, GitHub UI, or git shortlog; 72 is a hard ceiling.
Body. Explains why the change exists and what it does at a level the diff can't show: the problem, then the approach. The diff already says what changed line by line — don't restate it. Wrap at 72 characters, because git indents log output by 4 and terminals are 80. Omit the body only when the subject genuinely says everything.
A body is two short paragraphs, one to three sentences each, then it stops:
A third one-sentence paragraph is allowed only when a reader would otherwise be misled: the obvious alternative and why it lost, or the one thing you did not check. Most commits have neither. Not an inventory of caveats: a list of loose ends is a to-do note left where it can never be updated.
Add exponential backoff to user profile fetch retries
Previously, failed profile fetches retried immediately in a tight loop,
causing cascading timeouts during downstream auth service spikes.
This change introduces jittered exponential backoff starting at 100ms up
to a maximum of 5 seconds, capping attempts at 4 retries.
Claim only what the session establishes. Never assert a state you cannot observe — whether a page was opened in a browser, a deploy went out, someone checked it by hand. Ask when it matters to the message, and otherwise say nothing about it.
Everything else belongs somewhere that stays current when the code changes — how the code works goes in a comment, how to use it goes in the README, what changed line by line is already in the diff. A commit message is the only one of those that can never be updated, so it should carry only what will still be true and still be needed in a year.
The failure mode to watch for is a body that reads as a changelog of your own debugging session: every defect found, every dead end. That is interesting to the author on the day and noise to everyone after. If a reader would have to skim it to find the decision, it is too long.
A body past about six lines is narrating. Cut it back to the two paragraphs.
Never use -m for a commit that needs a body. Write it in the editor.
The dominant machine-readable convention, and what release automation reads. Spec in references/conventional-commits-1.0.0.md.
<type>[optional scope][!]: <description>
[optional body]
[optional footer(s)]
Types — feat and fix are specified; the rest are the de-facto Angular set:
| Type | Meaning |
|---|---|
feat | New capability for users of the code |
fix | Bug fix |
docs | Documentation only |
test | Adding or correcting tests only |
refactor | Neither fixes a bug nor adds a feature |
perf | Improves performance |
build | Build system or dependencies |
ci | CI configuration and scripts |
style | Formatting only, no code meaning changed |
chore | Maintenance with no src/test change |
revert | Reverts a previous commit |
Rules that matter:
feat(auth):, fix(parser):.: (colon and space) and is imperative, lowercase, no period.! before the colon (feat(api)!: drop v1 endpoints), or a BREAKING CHANGE: <description> footer. Use both when the break needs explanation. BREAKING CHANGE must be uppercase; BREAKING-CHANGE is a synonym.BREAKING CHANGE is case-insensitive to parsers.: or #, then a value. Tokens use hyphens instead of spaces (Reviewed-by, not Reviewed by).SemVer mapping: fix → PATCH, feat → MINOR, any breaking change → MAJOR. This is the entire reason the convention pays for itself — release-please, semantic-release, and changesets compute the next version and generate the changelog from the log.
Google doesn't use Conventional Commits; their CL descriptions are a plain imperative sentence plus a why-body. The two agree on everything that matters — imperative subject, blank line, body that explains why. Conventional Commits just adds a machine-readable prefix.
Follow the repository's existing convention. Run git log --oneline -30 before writing the first commit in an unfamiliar repo and match what's there. Introducing a new format into a repo that doesn't use it is noise, not rigor.
Structured key-value metadata in the last paragraph. Git parses them natively (git interpret-trailers), and forges index them.
| Trailer | Use |
|---|---|
Co-authored-by: Name <email> | Additional authors; GitHub/GitLab credit them on the commit |
Signed-off-by: Name <email> | Developer Certificate of Origin attestation — git commit -s. Required by the kernel, Docker, CNCF projects |
Reviewed-by: / Acked-by: / Tested-by: | Kernel-style review attribution |
Refs: #123 | References an issue without closing it |
Fixes: #123 / Closes: #123 | Auto-closes the issue on merge (GitHub/GitLab) |
BREAKING CHANGE: | Conventional Commits breaking marker |
Signed-off-by is a legal attestation of origin (DCO). It is not a cryptographic signature — that's -S. Don't conflate them.
Trunk-based development is the modern default and what DORA research associates with high-performing teams. One long-lived branch (main), short-lived feature branches measured in hours or days, merged continuously behind feature flags when incomplete. Long-lived branches are where merge pain, drift, and integration bugs come from.
| Model | Shape | Use when |
|---|---|---|
| Trunk-based | main + branches living <1–2 days, feature flags for incomplete work | Continuous delivery. The default. |
| GitHub Flow | main always deployable; branch → PR → review → merge → deploy | Web services, SaaS. Trunk-based with PRs formalized. |
| Release branches | Trunk plus release/x.y cut for stabilization, fixes cherry-picked back | Versioned software supporting multiple releases at once |
| git-flow | develop + main + feature/ + release/ + hotfix/ | Legacy. Its author has publicly recommended against it for continuously-delivered software. Use only for shipped, versioned, multi-version-support products. |
Branch naming: <type>/<short-description> in kebab-case — feat/oauth-pkce, fix/upload-retry, chore/bump-next-16. Add a ticket ID when the tracker requires it: feat/PROJ-482-oauth-pkce. Never work directly on main.
The golden rule of rebasing: never rebase commits that exist outside your repository — anything others may have based work on. Rebasing rewrites SHAs; anyone who pulled the old commits gets a divergent history and a painful recovery.
Safe and encouraged:
git rebase main on your own unshared feature branch, to keep history linear and replay your work on current trunk.git rebase -i to clean up your own unpushed commits before review — squash the "fix typo" commits, reorder, reword.git pull --rebase (set pull.rebase true) instead of generating merge bubbles on every pull.Use merge when:
main.PR merge methods — pick one per repo and stay consistent:
| Method | Result | Trade-off |
|---|---|---|
| Squash and merge | One commit per PR on main | Cleanest trunk, best when PR commits are messy. Loses intra-PR granularity, so bisect lands on whole features. Most common default. |
| Rebase and merge | Each commit replayed onto main, linear | Keeps granularity and linearity. Requires the author to have curated their commits. |
| Merge commit | Preserves branch topology | Full fidelity, noisiest graph. Correct for long-running integration branches. |
If your repo squashes, the PR title becomes the commit subject — so the PR title must follow the commit convention, not be a casual sentence.
google-cl-author for splitting strategies.SemVer 2.0.0 (references/semver-2.0.0.md). MAJOR.MINOR.PATCH:
Incrementing MINOR resets PATCH to 0; incrementing MAJOR resets both. No leading zeroes. 0.y.z means anything may change at any time — nothing is stable until 1.0.0, which is the act of declaring a public API.
Pre-release: 1.0.0-alpha.1, ASCII alphanumerics and hyphens, lower precedence than the associated release. Build metadata: 1.0.0+20130313144700, ignored for precedence.
Precedence compares major, minor, patch, then pre-release identifiers — numeric identifiers numerically, alphanumeric ones lexically in ASCII order.
Note: SemVer's promises are about your public API. Say what your public API is — a CLI surface, a library export list, a wire protocol, a config schema — or the version number means nothing to consumers.
Keep a Changelog (references/keep-a-changelog.md). CHANGELOG.md at repo root, newest release first, an [Unreleased] section at the top, ISO 8601 dates (2026-08-07).
Six change types, deliberately only six:
Added · Changed · Deprecated · Removed · Fixed · Security
Fixed = the behavior was wrong and is now correct. Changed = it worked as intended and now works differently. Security = addresses a vulnerability; lead with the CVE when there is one.**Breaking:** under Changed or Removed — don't collect them into a separate section.git log is not a changelog; it's a diff of a diff. Curate: drop what users can't observe.Automate it from Conventional Commits (release-please, semantic-release, changesets) when the log is disciplined enough to support it — then still read the output before shipping.
git tag -a v1.2.0 -m "Release 1.2.0". Annotated tags are real objects with a tagger, date, and message; lightweight tags are just a pointer and carry no provenance.v (v1.2.0) — near-universal, and what most release tooling expects.git push --tags or git push origin v1.2.0; tags don't travel with a normal push.git tag -s.Commit signing proves who authored a commit — the Author field is free text anyone can set.
SSH signing (git ≥ 2.34) is the low-friction option, reusing an existing key:
git config --global gpg.format ssh
git config --global user.signingkey ~/.ssh/id_ed25519.pub
git config --global commit.gpgsign true
git config --global tag.gpgsign true
GPG remains standard where a web of trust matters. Either way, upload the public key to the forge so commits show as Verified.
--force. Use --force-with-lease --force-if-includes, which refuses when someone else has pushed since your last fetch. Plain --force silently discards their work.main, develop, release branches, anything under review.--no-verify. Hooks exist because someone decided that check must not be skipped. If a hook is wrong, fix the hook..gitignore, .env discipline, and a secret scanner in pre-commit.git add -A blind. Review with git status and git diff --staged before every commit.git revert, not git reset, on published commits. Revert adds a new commit that undoes the change and keeps the record honest. Reset rewrites.git reflog — the safety net. Nearly anything "lost" in the last 90 days is recoverable from here, including after a bad reset or rebase.git reset --hard <sha-from-reflog> to return to a known-good state.git bisect start / bad / good, or git bisect run <script> to automate — finds the introducing commit in log₂(n) steps. Only works if commits are atomic and each one builds.git log -S'<string>' (pickaxe) to find the commit that introduced or removed a string. git log -L to follow a function's evolution.git blame -w -C ignores whitespace and follows moved code..pre-commit-config.yaml) — the general standard; runs formatters, linters, and secret scanners across languages.Hooks are not a substitute for CI; they're a fast local echo of it. CI is the authority because hooks can be bypassed and aren't installed by default on a fresh clone.
references/conventional-commits-1.0.0.md — full specreferences/semver-2.0.0.md — full specreferences/keep-a-changelog.md — full specWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub fishnos/claude-config --plugin google-engineering5 skills in this plugin
/google-cl-authorAuthor changes the way Google expects them — one self-contained change per commit/PR, tests in the same change, a description that says what and why, and collaborative responses to review feedback. Use when planning how to split work into commits or PRs, writing a commit message or PR description, deciding whether a change is too big, or responding to review comments. Encodes google/eng-practices CL author guide./google-code-reviewReview code the way Google reviews a CL — design first, then functionality, complexity, tests, naming, comments, style, consistency, documentation, every line. Use whenever reviewing a diff, PR, branch, or file someone (including you) just wrote; whenever asked to "review", "check", "look over", "critique", or "audit" code; and as a self-review pass before reporting any implementation as done. Encodes google/eng-practices reviewer guide./google-styleGoogle's language style guides — TypeScript, JavaScript, HTML/CSS, Python, Shell, Go, Java, C++, C#, Objective-C — as the authority on formatting, naming, comments, and language-feature use. Use before writing or editing code in any of these languages, when reviewing style in a diff, when naming things, when deciding whether a language feature is allowed, or when a style disagreement needs an authority. Carries the full text of each guide in references/./google-testingGoogle's testing discipline — test sizes and scopes, the 80/15/5 mix, testing behaviors not methods, DAMP over DRY, preferring real implementations over mocks, and avoiding brittle change-detector tests. Use when writing or reviewing any test, deciding what to test or at what level, choosing between a real object, a fake, and a mock, debugging a flaky or brittle test, or judging whether a change has adequate test coverage. From Software Engineering at Google and Testing on the Toilet.