Pcornel
Automation · Git

Commit

Cheat sheet · https://pcornel.dk/topic.php?topic=5468

Back to the Topic

Answer

A Git commit is an immutable snapshot object plus metadata and parent relationship, while branch names are movable references that may later point elsewhere.

Remember

  • Commit exists ≠ change deployed; downstream systems may never consume that commit.
  • Commit message ≠ commit contents; inspect the tree/diff rather than trusting description text.
  • Author metadata ≠ cryptographic identity proof; configurable metadata is not authentication.
  • Committed ≠ backed up remotely; a local commit can be lost with the local repository.

First checks

  • git add -p — stage selectively
  • git commit -m '<type>: <summary>' — commit
  • git show --stat HEAD — review commit

Verify in this order

staged changes → commit

Where it usually breaks

Creating a commit proves a specific snapshot and ancestry exist locally; it does not prove remote durability, approval, build success or deployment.

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.

Commit Git boundary map

BoundaryHealthy evidenceSuspicious evidence
Local stateRepository, HEAD, worktree/index and commit IDs are explicitWrong repo/ref, hidden staged/untracked state or mutable-name ambiguity
History / refsAncestry and branch/tag movement match intentUnexpected rewrite, stale tracking ref or unclear merge base
Remote syncURL/refspec, auth and remote read-back match expected commitsLocal assumptions, rejection, stale fetch or unsafe force update
Downstream proofBuild/reconciliation/target is verified independentlyPush/tag/merge success treated as deployment success

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5468

Confirmation

Confirm action

Continue?