Vibe Coding

Git, Diffs, and Small Commits

Commit after each working slice. Keep history clean so you can undo a bad generation.

Git is the safety net

Agents can delete files, rewrite tests, and wander into unrelated folders. A commit from ten minutes ago is cheaper than reconstructing from memory.

Rules

  • Commit before a risky prompt ("refactor the package layout").
  • Commit after tests pass for the slice you asked for.
  • One idea per commit: "Add notes export" not "stuff the agent did."
  • Do not ask the model to rewrite git history, force-push, or skip hooks.

Never let an agent run destructive git commands. You type git reset and git restore yourself when you mean it.

Undo a bad generation

# Discard uncommitted agent changes (careful)
git restore .
git clean -fd   # only if you understand it will delete untracked files

# Or reset the last commit you do not want (not pushed)
git reset --hard HEAD~1

Prefer git restore on specific files when you still want other work in the tree.

Commit messages you write

Do not accept "Update files" from the model. You know the intent.

git add notes.py test_notes.py
git commit -m "Add notes search command"

How you use Git in a vibe session

  1. Start clean: git status. Commit or stash anything you already trust.
  2. After a green slice, git add only the files you reviewed. Never git add . if the agent created junk.
  3. Write the message yourself: what the slice did, not “update files.”
  4. If the generation is bad, restore specific files first. Hard reset only when you mean to throw away the whole slice and it is not pushed.

Pull requests stay small

If you work on a branch, open a PR per feature slice, not per afternoon of vibes. Reviewers (including future you) cannot review a 2,000-line agent dump.

Try it yourself

The agent created tmp_server.py you do not want, and improved notes.py that you do. How do you commit?

Show solution
git restore tmp_server.py
# or delete it if it is untracked: remove the file
git add notes.py test_notes.py
git commit -m "Add notes search command"

Key takeaways

  • Green slice, then commit.
  • You own git. The agent owns the draft.
  • Small commits make revert a strategy instead of a disaster.
  • Never git add . after a surprise generation.

FAQ: Git, Diffs, and Small Commits

Common questions about this page.

What is vibe coding?

Vibe coding is building software by directing an AI in natural language while you review, test, and own the result. The StudyGrid Vibe Coding course teaches the workflow, prompts, and habits that make it work.

Should I run git for vibe coding examples locally for better learning?

Yes. Use the browser editor on StudyGrid for a quick check, then Download the example and run it on your computer. Local runs show real errors and the real toolchain, which is one of the fastest ways to learn git for vibe coding in this Vibe Coding AI lesson (Git, Diffs, and Small Commits).

How do I vibe code the right way?

Give one clear goal, attach the files that matter, ask for a plan first, review every diff, run tests, then commit a small slice. The How You Work lesson is the session guide. Best Practices is the full playbook.

How does a user actually work with vibe coding?

You open a real project in an agent editor or CLI agent (Cursor, VS Code + Copilot, Claude Code, and similar), write one goal, attach two or three files, ask the agent to plan then implement a small slice, read the diff, run tests yourself, and commit. You are the director. The model drafts. The How You Work lesson walks through a 30-minute session. The Tools lesson is the stack picker.

Is vibe coding only for experts?

No. Beginners can use it to learn faster if they read the generated code. Experts use it to move quicker on boilerplate while keeping architecture and review in their hands.

What tools do I need for vibe coding?

You need an agent that can read your project, edit files, and show a diff — for example Cursor, VS Code with GitHub Copilot, Claude Code, Codex CLI, Continue, or Windsurf — plus Git for undo and a language you can read (this course uses Python). A browser chatbot is not enough. The Tools lesson compares the stacks. Setup covers the checklist.

Which AI coding tool should I use for vibe coding?

Pick one stack and stay with it for a project. Cursor is a common agent editor. VS Code plus GitHub Copilot fits if you already work there. Claude Code and Codex CLI are terminal agents. Continue, Windsurf, Zed, and JetBrains AI Assistant also work if they can apply a diff. Do not hop tools on a dirty tree.

Is the Vibe Coding course free?

Yes. The full Vibe Coding course on StudyGrid (studygrid.in) is free. Open the header menu, start at What Is Vibe Coding, then How You Work and Tools, and follow Next through the project and cheatsheet.