The Complete Claude Guide
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.

Verified against source on 2026-09-30

Video

Steps

  1. Before a change, check git status and diff to know the current work state and avoid trampling your own edits.
  2. Checkpoints are saved automatically during the session and allow rewind to an earlier point without losing other work.
  3. Ask for a commit with a clear message after tests pass; the tool can draft messages, but you approve.
  4. 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

Official sources

← Previous Back to contents Next →