Commits and branches through the agent
So far Claude Code has edited files and fixed code. In this lesson we'll see what happens when it also saves the change to git: opening a dedicated branch instead of touching main, choosing exactly which files belong in the commit instead of dumping everything in, and writing a commit message that e
Working well with the agent is like giving a carpenter a fresh workbench for every new order — he brings over only the tools that order needs, and tapes a note to each finished piece explaining why it was built that way, not just what's inside.
- branch
- A separate copy of the project's code you can work in without touching main, merging it back only once the change is ready.
- the staging area (git add)
- The set of changes explicitly chosen to be included in the next commit; a file that changed but wasn't passed to git add is left out of the commit.
- commit message
- The text documenting why a change was made, not just which lines changed — so someone reading it six months later understands the reason.
- force-push
- A push that overwrites the remote branch's history instead of adding to it; it can erase other people's work and requires explicit prior approval.
- skipping hooks (--no-verify)
- Running a commit while bypassing the pre-commit checks meant to catch problems in advance; skipping it disables that safety net, so it requires an explicit ask before doing it.