Pcornel
Automation · Git

Repository

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

Back to the Topic

Answer

A Git repository is a project's complete version history: all commits, branches and tags, stored in the .git directory alongside a working tree of checked-out files. Clones are full copies of the repository.

Remember

  • Repository exists ≠ worktree clean; tracked, staged and untracked changes can still be present.
  • Directory contains .git ≠ normal standalone repository; .git may be a file pointing to shared metadata or worktree state.
  • Object database present ≠ refs healthy; refs can be missing, stale or inconsistent independently.
  • Repository reachable ≠ repository trusted; provenance and access policy remain separate security boundaries.

First checks

  • git rev-parse --show-toplevel — repo root
  • git count-objects -vH — size
  • README, CODEOWNERS, .gitignore present — hygiene

Verify in this order

repo → files + history

Where it usually breaks

Opening a valid repository proves Git metadata is readable, not that its worktree is clean, its refs are intended or its content is safe to consume.

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

Repository 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=5466

Confirmation

Confirm action

Continue?