LA24AI

Tools worth exploring

Git: save a checkpoint you will understand next week

Commit AI edits only after reviewing staged files and excluding secrets, keeping local history distinct from backup and deployment.

Git: save a checkpoint you will understand next week

Commit the intended snapshot

Git records tracked file history, not every file on the device. Working changes, staging and commits are distinct. Three edited files do not imply three staged files.

Inspect staging before committing

In a demonstration repository, create README.md and follow the commands. Inspect the staged diff before committing. Avoid indiscriminate staging of credentials or large outputs. Configure an appropriate local Git identity if required.

Worked exampleshell
git init
git status
git add README.md
git diff --cached
git commit -m "Document how to run the example"
git status

Run in a test folder containing README.md; these commands create a local repository and commit.

Download example text ↓

Explain the purpose in the message

Use a message explaining purpose rather than “update.” A local commit is not automatically an off-device backup. Check status afterward to identify remaining uncommitted work.

Inspect the snapshot the commit will actually record

git diff shows unstaged work; git diff --cached shows the pending snapshot. Editing after staging can leave the newest change outside that commit. Keep AI changes focused, such as one date-validation repair with its regression check. A purpose-bearing message helps explain behavior later.

Exclude credentials and backups before initial tracking. .gitignore does not untrack an existing secret, and removing it from today’s file does not erase history; exposed credentials require revocation or rotation. Review files and status before pushing or deploying. Local commits restore tracked code; protection against device loss requires an independent copy or trusted remote repository.

Prove that your checkpoint can retrieve a file

Practice in a disposable repository, not on an important working tree. Create a README.md, inspect `git diff --cached -- README.md`, and commit a known-good version. Now change one line without staging it. The change should appear in `git diff -- README.md`, not in `git diff --cached -- README.md`. These two commands inspect different layers of the same working tree.

Before any destructive rollback, use `git show HEAD:README.md`. This reads the file from the latest commit without overwriting your working copy. It requires an existing commit and the file path at that commit. Compare the displayed version with your current file: you have now demonstrated a recoverable checkpoint, rather than merely seeing a successful commit message.

Three non-destructive checkpoint checks
WhenRead-only checkExpected evidenceStop if
Before committing`git status --short` and `git diff --cached --name-only`Only intended files are stagedSecrets, config or generated artifacts appear
After a new edit`git diff -- README.md`Unstaged change is visibleUnrelated files also changed
Before restoration`git show HEAD:README.md`Saved file is readable without overwriting workNo HEAD exists or the path is wrong

A safe checkpoint you can inspect before asking AI to edit code

Suppose an assistant proposes changing a Python function. Before accepting the change, create a small repository containing only a README and the script. Check what Git is tracking, then capture the version that already runs. This gives you a known state to compare with the proposed edit; it does not automatically back up untracked files or secrets.

Try this sequence

  1. Create a fresh practice directory, add README.md with the expected output, and run git init there. Do not initialize Git inside an unrelated project by accident.
  2. Run git status; check .gitignore before staging. Use git add README.md rather than adding everything, and inspect git diff --cached before committing.
  3. Commit the checked baseline, let the assistant propose one specific edit, and inspect git diff before running the changed code. A diff shows changed text, not whether the new behavior is correct.
  4. Run a known input through the program before and after the change. Save the actual observed output or a test result; do not describe an unrun test as passed.

What counts as a successful checkpoint?

A practice repository with one baseline commit, a clean git status immediately after that commit, and a visible one-file diff when you change the script. A clean working tree does not prove the code works; the separate test establishes that.

Scope and limits: Never commit .env files, API keys, tokens, client datasets or large model weights. A local commit is not an off-device backup. Avoid destructive reset/clean commands until you understand what they remove.

Sources & further reading

Git commands are reproducible educational examples, not a test performed on a visitor’s repository. Avoid destructive reset or restore before inspecting the diff.

Sources support concepts and features; proposed trials are educational examples.

Prepared with AI assistance. Educational examples are not product tests; actual measurements identify their method and scope. Editorial approach ↗

NEXT

One idea leads to another

2 min read

Review AI code through its diff and behavior: reproduce the original failure, test boundary and Arabic inputs, and inspect side effects before acceptance.

3 min read

Update one library with a reproducible lockfile, task-level regression and verified rollback instead of treating a successful build as proof of compatibility.

2 min read

Separate account recovery from API credentials, avoid plaintext exports in AI uploads, and verify a password-manager migration without exposing secrets.