Vibe Coder Field Guide · 03
The 22 Git words
before your AI touches real code.
Version control in plain English for builders who just let Claude Code, Cursor, or Copilot start editing real files. Pin this above your monitor before the agent saves over something important.
Reviewed byCraig Petronella
CredentialCMMC-RP #1449
LicenseNC DFE #604180
Since2002
Get the printable PDF
Pin it next to your keyboard. Free, no obligation.
Call Penny · 919-348-4912
Answers 24/7, can schedule an expert
↓ the field guide ↓
Pin this above your monitor.
The Vibe Coder Git Field Guide
22 words you'll meet in your first week letting an AI commit to a real repo.
§01
Anatomy of a Git change
how one edit moves from your disk to a teammate's screen
working tree(edit login.ts) → git add(staging area) → git commit["why this change"] → git push → origin/main
working tree is the files on disk you and the AI are editing.
staging area is what you've chosen to commit. Not everything you changed.
commit is a signed snapshot with a message. Future-you will read it.
§02
Local Git basics, 10 terms
everything Git does on your laptop before anyone else sees itRepository
A folder Git tracks. Every file, change, author, forever.
Working Tree
The files on disk right now. What you and AI are editing.
Staging Area
The waiting room between edits and a commit. You pick.
Commit
A signed snapshot at one moment, with a message.
Branch
A parallel timeline. Try things without breaking main.
HEAD
Git's pointer to where you are. Branch + commit, right now.
Tag
A permanent label on a commit. Usually v1.2.0.
.gitignore
Files Git is told to never track. First line of secret defense.
Status
What changed since last commit. Staged, modified, untracked.
Log
The ordered history of every commit on this branch.
§03
Collaboration & GitHub, 8 terms
how Git stops being a solo journal and becomes a team workflowRemote
A copy of your repo on a server. Usually GitHub.
Origin
Default name for the remote you cloned from. Home base.
Clone
Pull a full copy of a remote down, history and all.
Push
Send your local commits up to the remote.
Pull
Download new commits from remote and merge them in.
Fork
Your own server-side copy of someone else's GitHub repo.
Pull Request
A proposal to merge your branch. Discussion, review, approve.
Code Review
Second eyes on a diff. Cheapest bug filter you have.
§04
The 2 disasters everyone hits, and the 2 that bite hardest
how to recover, and what an auditor will ask about laterMerge Conflict
Git surrenders when two branches edit the same lines. You choose.
Revert
A new commit that undoes a bad one. History stays intact.
Leaked Secret ⚠
A key committed once is public forever. Rotate, don't hide.
Force Push to Main ⚠
Overwrites shared history. Erases teammates. Never on main.
§05
Anti-patterns & first-day checklist
the mistakes everyone makes when AI starts committing, and the moves that prevent them✗ Anti-patterns
- Letting the AI commit straight to main with no review or branch protection.
- Accepting auto-generated commit messages like "fix bug" or "update files."
- Pasting your .env file into a chat to "let the AI see the config."
- Running git push --force on a shared branch to "clean up history."
- Pulling without reading what changed, then wondering why nothing works.
✓ First-day checklist
- Add .env, .env.local, *.pem, secrets/ to .gitignore before your first commit.
- Turn on branch protection: require pull request + review + green tests on main.
- Run a secret scanner like gitleaks or git-secrets in your pre-commit hook.
- Make the AI work in feature branches. Humans approve the merge.
- Stuck on a CMMC, HIPAA, or NDA question? Call us at 919-348-4912.
§06
The ship-it gate
run before you let an AI-authored pull request merge into main- You read every line of the diff yourself, not just the summary.
- No keys, tokens, .env values, or hardcoded URLs in the patch.
- Commit message explains why, not just what. Edit if the AI was lazy.
- Tests pass on the branch. You added at least one for the new behavior.
- Branch is up to date with main. No surprise merge conflicts.
- Pull request has at least one human approval before you click merge.
"Commit early. Commit often. Commit before the AI does."
Craig Petronella
CMMC-RP RPO #1449 · NC DFE #604180
petronellatech.com · 919-348-4912
petronellatech.com · 919-348-4912
Want the printable version?
Letter size, formatted for the wall next to your monitor. Drop your email above and we will send the printable to your inbox.
Now in plain English, with the security note.
Each term gets three lines: what it means, an example you've probably hit, and what your future security audit will ask about it.
Local Git Basics
Repository
- What it means
- A project folder that Git tracks. Every file, every change, every author, all kept in a hidden .git directory at the root.
- Real-world example
- Run git init in a new folder, or git clone someone-else/their-repo to copy theirs. Either way, you now have a repository.
- Security note
- The .git directory holds the complete history. Backing up only your current files is not a backup of your repository. Anything ever committed lives forever.
Working Tree
- What it means
- The actual files on disk that you and the AI are editing right now. The non-Git view of your project.
- Real-world example
- When Claude Code writes to src/auth.ts, it changes the working tree. Git does not know about that change until you stage it.
- Security note
- An AI agent with file-write access can modify anything in the working tree, including .env files Git is told to ignore. Sandbox the agent's working directory.
Staging Area
- What it means
- The waiting room between your edits and a commit. You add files with git add to stage them, then commit only what you staged.
- Real-world example
- The AI changed 12 files but only 3 are part of the feature you want to ship. git add those 3, leave the rest, commit clean.
- Security note
- git add . stages every changed file, including ones that should not ship: debug logs, test credentials, the .env you accidentally edited. Stage by name, not by wildcard, when secrets are in scope.
Commit
- What it means
- A signed snapshot of your project at one point in time, with a unique hash, an author, a timestamp, and a message explaining why.
- Real-world example
- git commit -m "Add bcrypt to login flow, fixes CMMC IA.L2-3.5.10". That hash becomes a permanent rollback point.
- Security note
- Commit history is an audit trail. For CMMC, HIPAA, or SOC 2 scope, signed commits with GPG or sigstore prove the author was actually them, not a stolen credential.
Branch
- What it means
- A parallel timeline of your project, named, where you can try things without breaking the main line of work.
- Real-world example
- git checkout -b ai-refactor-auth, let the agent rewrite the auth flow there, and only merge to main once you have read every line.
- Security note
- Every AI session should get its own branch. If the agent goes off the rails, you delete the branch and main is untouched.
HEAD
- What it means
- Git's pointer to where you are right now: which branch is checked out, and which commit is its tip.
- Real-world example
- After git checkout main, HEAD points to main. After git checkout abc1234, HEAD points to that commit, "detached" from any branch.
- Security note
- Detached HEAD is where work goes to die: commits made there are not on any branch, so a checkout elsewhere quietly orphans them. Always commit on a named branch.
Tag
- What it means
- A permanent label pinned to a commit. Usually a version number like v1.2.0 or a release name.
- Real-world example
- git tag v1.0.0 marks the commit you shipped to production. You can always git checkout v1.0.0 to rebuild that exact code.
- Security note
- For regulated builds, sign your release tags (git tag -s). An unsigned tag is just a label anyone with push access can move.
.gitignore
- What it means
- A plain-text file that lists patterns Git should refuse to track. Your first line of defense against committing the wrong thing.
- Real-world example
- .env, *.pem, node_modules/, .vscode/, dist/. Add these before your first commit, not after the leak.
- Security note
- .gitignore only stops files Git has not yet tracked. If you committed a secret before adding the pattern, the secret is still in history. Rotate the secret immediately.
Status
- What it means
- Git's report of what changed since your last commit: which files are staged, which are modified, which are new and untracked.
- Real-world example
- git status before every commit. Tells you exactly what an AI agent left behind in your working tree.
- Security note
- If git status shows a file you do not recognize, do not stage it. Prompt-injected agents have written extra files that exfiltrate data on next commit.
Log
- What it means
- The ordered history of every commit on the current branch, with hash, author, date, and message. Your project's diary.
- Real-world example
- git log --oneline --graph shows the last 20 commits as a tree. Helpful when an agent claims it did something and you are not sure.
- Security note
- For incident response, the log is your forensic timeline. Date-fudged or rewritten commits look suspicious in an audit, even if the change was legitimate.
Collaboration & GitHub
Remote
- What it means
- A copy of your repository that lives somewhere else, usually on a server like GitHub, GitLab, or Bitbucket.
- Real-world example
- git remote -v shows where your repo pushes and pulls from. Most projects have one remote called origin.
- Security note
- A remote you do not control is a remote that can read your code. Self-hosted Git or a private GitHub Enterprise repo is required for most CMMC L2 and CUI work.
Origin
- What it means
- The default name Git gives the remote you cloned from. Your home base for push and pull.
- Real-world example
- git push origin main sends your local main branch up to the server. The name "origin" is just a convention, not magic.
- Security note
- Double-check origin before pushing. Renaming a remote takes one command, and the wrong origin URL has shipped private code to public mirrors more than once.
Clone
- What it means
- Downloading a full copy of a remote repository to your machine, including all history, branches, and tags.
- Real-world example
- git clone https://github.com/anthropics/claude-code-action.git pulls down the whole project, ready to work on.
- Security note
- A clone of a public repo includes every secret ever committed, even if those files have since been deleted. Use a tool like git-secrets to scan a fresh clone before you trust it.
Push
- What it means
- Sending your local commits up to a remote so other people, including future-you on a different machine, can see them.
- Real-world example
- git push origin feature/bcrypt uploads your branch to GitHub, where you can open a pull request against main.
- Security note
- A push to a public branch is permanent. Crawlers will index it within minutes. If a secret made it through your pre-commit check, assume it is already exfiltrated.
Pull
- What it means
- Downloading new commits from a remote and merging them into your local branch in one step.
- Real-world example
- git pull origin main before you start editing, so the AI is working against the latest code, not yesterday's snapshot.
- Security note
- git pull silently runs git merge. If a teammate's branch was tampered with, the merge can pull malicious code into your tree. Review unfamiliar commits with git log before pulling.
Fork
- What it means
- Your own server-side copy of someone else's GitHub repository, where you can experiment freely without affecting the original.
- Real-world example
- Click "Fork" on a public repo, clone your fork, push changes there, open a pull request back to the original.
- Security note
- A public fork makes every commit you push visible to the world, even if the original repo is later set private. Forks of private repos can leak if you ever change visibility.
Pull Request
- What it means
- A GitHub feature where you propose merging one branch into another, with built-in discussion, line comments, and approval gates.
- Real-world example
- The AI commits to feature/bcrypt, opens a PR against main, a human reviews it, CI runs the tests, then you click merge.
- Security note
- For any code touching auth, data handling, or money, require at least one human reviewer and one passing security scan before merge. GitHub branch protection rules enforce this automatically.
Code Review
- What it means
- A second pair of eyes reading your diff before it lands. The cheapest bug filter you have and a required control under most compliance frameworks.
- Real-world example
- Your teammate flags that the AI's "improvement" silently drops the rate limit on the login endpoint. You catch it before it hits production.
- Security note
- For CMMC, HIPAA, and PCI scope, review is not optional. Document that a second human looked at every change to in-scope code, with the reviewer's name in the PR.
Recovering & Security
Merge Conflict
- What it means
- When two branches changed the same lines of the same file, Git surrenders and asks you to choose which version wins.
- Real-world example
- You and the AI both edited login.ts. Git marks the conflicting block with <<<<<<< HEAD and =======. You edit the file by hand, then git add it.
- Security note
- Never let an AI resolve conflicts blindly. It picks whichever version looks "cleaner" and can quietly drop a security check from one side. Resolve by hand or have a human review the resolution.
Revert
- What it means
- A new commit that undoes the changes of a bad one. The history stays intact; the damage backs out cleanly.
- Real-world example
- git revert abc1234 creates a fresh commit that is the exact opposite of abc1234. Safe to use on a shared branch.
- Security note
- Revert is safer than git reset or force push for fixing a bad change on main, because it leaves an audit trail. Auditors prefer "you reverted it" over "you erased it."
Leaked Secret in History
- What it means
- A credential, API key, or password that got committed to a repository. Once pushed, it is permanent, public, and indexed.
- Real-world example
- Someone commits .env to a public repo with AWS_SECRET_ACCESS_KEY inside. Within minutes, automated scrapers find it and crypto-mining bots are spending the AWS bill.
- Security note
- A leaked AWS key in git history is permanent unless you rewrite history, and even then crawlers have already grabbed it. The fix is rotation, not deletion. Notify your compliance officer; this is a reportable incident under most frameworks.
Force Push to Main
- What it means
- Using git push --force on a shared branch, overwriting whatever history was on the server with whatever you have locally.
- Real-world example
- An AI agent "cleans up" the history with rebase, then force-pushes main. Every teammate's local main breaks. Their next pull fails or, worse, silently overwrites your "fix."
- Security note
- Turn on GitHub's "Do not allow force pushes" rule for main and any release branch. A force push is how an attacker with stolen credentials erases evidence of what they tampered with.
Common questions from new builders.
Things people ask us in the first week of letting an AI commit to a real repository.
What is Git in plain English?+
Git is a system that keeps a complete history of every change to every file in a project, so you can rewind, branch off, or hand work to a teammate without overwriting each other. It runs on your machine. GitHub is the most popular cloud service that hosts Git repositories so a team can share them. You use Git the tool. You collaborate on GitHub the service.
Why do I need Git if the AI is doing the coding?+
Because the AI is fast, confident, and occasionally very wrong. Git is your undo button when an agent edits the wrong file, deletes a function you needed, or rewrites your auth flow at 11pm. Without commits, you have no way to roll back a bad AI session without losing every other change you made that day. The first thing we tell every new vibe coder: commit before you let the AI start, and commit often while it works.
Is it safe to put my code on GitHub?+
Public repositories are visible to the entire internet and to every AI training crawler that has ever existed. Anything inside, including a key you accidentally committed three months ago, is permanent. For client work, customer data, or anything under HIPAA, CMMC, or NDA, use a private repository, scan every commit with a secret-detection tool, and require pull-request review before code lands on main. When in doubt, call us at 919-348-4912.
How do I get a leaked API key out of git history?+
You do not. Treat that key as burned the moment it was pushed. Rotate it at the provider immediately, then use a history-rewriting tool like git filter-repo or BFG Repo-Cleaner to strip it from past commits, and force-push the cleaned history. The old commits will still exist in every clone and every fork until those copies sync. Crawlers have already grabbed it. Rotation is the only real fix, and for CMMC or HIPAA scope this is a reportable incident.
What is the difference between a pull and a pull request?+
A pull, lowercase, is a Git command that downloads new commits from a remote into your local branch. A pull request, capitalized, is a GitHub feature where you propose merging one branch into another and invite teammates to review, comment, and approve before the merge happens. Same word, very different scope. GitLab calls the same idea a "merge request" to avoid this confusion.
Should I let an AI agent push directly to main?+
No. An agent with push rights to main can ship broken code, leaked secrets, or malicious changes the moment its prompt gets hijacked. Make the agent commit to a feature branch and open a pull request. Require a human approval and a passing test suite before merge. GitHub's branch protection rules enforce this for you, and they are the single most effective control we recommend to every client running AI-assisted development.
What is a good commit message?+
A short summary line under 72 characters that explains why the change exists, followed by a blank line and an optional longer body that gives context. Future-you, reading the log six months from now, should understand the intent without opening the diff. Auto-generated messages like "fix bug" or "update files" are signs an AI wrote the commit without context. Edit them. Bad example: "changes". Good example: "Add bcrypt to login flow, replaces MD5, fixes CMMC IA.L2-3.5.10".