Chapter 11 · CLI
Git: diffs, checkpoints, commits and pull requests
Claude Code works hand in hand with git: reviewing diffs, creating clean commits and opening pull requests. The checkpointing mechanism lets you roll back even without a commit, and it is the safety net of the work.
Video
Steps
- Before a change, check git status and diff to know the current work state and avoid trampling your own edits.
- Checkpoints are saved automatically during the session and allow rewind to an earlier point without losing other work.
- Ask for a commit with a clear message after tests pass; the tool can draft messages, but you approve.
- Opening a pull request through the tool saves typing, but the content and reviewers are your call.
Common pitfall: A checkpoint is not a git substitute: it is local to the session and machine. Work that matters needs a real commit to survive.
Hands-on exercise: Make a small change, view the diff, ask for a commit with a fitting message and confirm the history is clean. Try a checkpoint rewind before the commit.
Filmed demo · Video is added in the media phase
Recap
Comprehension check
What is the difference between a checkpoint and a commit?
Recap
- Check status before changing
- Checkpoints for quick rollback, commits for keeps
- PRs via the tool, responsibility on you