Day-2 Git with Grok

You shipped something. Now save it with git—safely—with Grok as a helper, not the boss of your history.

After a First Ship walkthrough (game or app) or any project you care about ~20 min
Big idea

Git is a save system for code. Grok can run git commands and draft commit messages. You decide what gets recorded forever—especially force pushes, history rewrites, and commits of secrets.

Why “day 2”?

Day 1 was shipping something that runs. Day 2 is not becoming a git expert. It is learning enough to:

  • See what changed (status, diff)
  • Save a checkpoint you could return to (commit)
  • Stop Grok from “helpfully” rewriting history or committing junk

If you have never installed git, do that first on your machine, then come back. This lesson assumes git --version works in a terminal.

Words you need (plain English)

WordMeaning
Repository (repo)A project folder where git is tracking history
CommitA saved snapshot with a short message (“what changed and why”)
StatusWhich files are new, changed, or staged
DiffThe line-by-line change since the last commit
StageMark which changes go into the next commit
BranchA named line of work (start with main only)

Who decides what (Grok vs you)

Usually fine for Grok (with you watching)

  • git status, git diff, git log -5
  • Draft a commit message from the diff
  • Stage specific files you named
  • Create a commit after you approve the message and file list

Human decides (or forbid by default)

  • Force push, hard reset, history rewrite
  • Commit of .env, keys, passwords, huge binaries
  • “Clean” the repo by deleting untracked work you still need
  • Pushing to a shared remote without your OK

Stay on Ask permission mode while learning git. If Grok wants a destructive command, deny it and say: “Only status, diff, and a normal commit—no force or reset.”

Do not send

“Fix the repo however you want—use force push if needed.”

Send this kind of prompt

“Run git status and git diff. Summarize changes. Propose a commit message. Do not commit until I say yes. Never force push or reset.”

Status & diff (your daily loop)

Before any commit—yours or Grok’s—run the same two checks:

  1. Status — what is dirty?
    git status
  2. Diff — what actually changed?
    git diff
    git diff --staged

Ask Grok to explain the diff in plain English, then skim the real lines yourself for secrets and accidental files.

Secrets check

If the diff shows API keys, tokens, or passwords, do not commit. Remove them from the files, add the secret path to .gitignore, and rotate the key if it already leaked into chat history or a remote.

Commit habits that keep you safe

  1. Small commits — one idea per commit when you can (e.g. “Add restart button”, not “misc fixes”).
  2. You own the message — Grok drafts; you edit. Prefer present tense: “Add win screen” over “Fixed stuff”.
  3. Stage intentionally — prefer naming files over blind git add . until you trust the tree.
    git add index.html css/style.css js/main.js
    git commit -m "Add restart button and win message"
  4. Verifygit status should be clean (or only show work you left out on purpose).
Goal: Help me prepare a safe git commit. Do not commit yet.

1. Run git status and git diff in this project.
2. List files that should and should not be committed.
3. Draft a one-line commit message.
4. Stop and wait for my yes/no before any git add or git commit.
5. Never use force, reset --hard, or push unless I explicitly ask.

Lab

Use the project from your ship walkthrough (or any practice folder with a few changed files).

  1. In a terminal, cd into the project. If git is not initialized yet:
    git init
    git status
  2. Start Grok in that folder. Stay on Ask mode.
  3. Send the “Goal: Help me prepare a safe git commit…” prompt above (copy the whole box).
  4. Read Grok’s summary. Open the real git diff yourself. Confirm no secrets.
  5. If the draft message is good, reply: “Yes—stage only these files: …” and list them. Approve the commit command when Grok proposes it. If anything looks wrong, say “No commit. Stop.”
  6. Run git log -1 --oneline and confirm the snapshot is yours.
Done when

You can explain status vs diff in one sentence each; you have either made a reviewed commit with Grok’s help or deliberately stopped before a bad commit; and you know three git actions you will not let Grok do alone (force push, hard reset, commit of secrets).

Quick check

1. Who should decide force push / hard reset?
2. Best first step before a commit?
3. Grok drafts a commit message. You should…

Next in the path: Intermediate daily habits—start with Slash Commands if you have not already.