Pcornel
Automation

Git

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

Back to the Topic

Answer

Git is the distributed version-control layer that records content snapshots and references so automation changes can be reviewed, compared, integrated, reproduced and traced without treating repository state as deployed target state.

Remember

  • Repository state ≠ deployed state; Git records versioned intent and history but does not prove infrastructure or application convergence.
  • Working tree ≠ index ≠ commit; edits, staged content and recorded snapshots are distinct states.
  • Local history ≠ remote history; refs can diverge until fetch/push synchronization is observed.
  • Git ≠ GitOps; Git provides version control while GitOps adds declarative desired state and reconciliation.

First checks

  • git status — working tree
  • git log --oneline -10 — history
  • git remote -v — remotes

Verify in this order

edit → commit → push → review → merge

Where it usually breaks

A clean or synchronized repository proves only version-control state. It does not prove that a downstream pipeline ran, a GitOps controller reconciled or the target system matches the committed intent.

Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness. Preserve at least three independent checks: prerequisite/interface or identity/transport state; the owning control/service/policy state; then effective data-plane, backend or workload state. A healthy upstream boundary does not prove the downstream consumer or return path.

Git 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=5464

Confirmation

Confirm action

Continue?