Walkthrough

Git Operations and Commits

Letting the agent stage, write a real commit message, and stop short of pushing.

Claude Code can stage changes, write commit messages, and even create branches — but by default it will not push or force-push without explicit confirmation. Treat git operations like any other risky tool: gate them through your approval.

Steps · 0 / 3 done
  1. Ask for a commit

    After making changes, ask the agent to commit. It will run status, diff, and log to read the project's commit style first.

    Commit my changes. Use the existing commit message style in this repo.
    VerifyYou see Bash calls for `git status`, `git diff`, `git log`, then a commit with a message that matches the repo's tone.
  2. Refuse the auto-push

    If the agent offers to push, say no. Push is a shared-state action — keep that on your hands.

    Do not push. I'll review the local commit first.
    VerifyThe session ends with the commit local; you can `git log -1` and inspect.
  3. Reset gracefully

    If the message or content is wrong, ask the agent to soft-reset and try again, rather than amending.

    Soft-reset the last commit. I want to make a different change.
    Verify`git status` shows the changes back in your working tree, ready to be re-committed.
Check your understanding
Q1. Why is `git push` a different category of action than `git commit` for the agent?
· Tick off the 3 step(s) above.
· Score 100% on the quiz.