Pcornel
Automation · Git

Clone

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

Back to the Topic

Answer

Clone creates a new local repository from another repository and initializes remote-tracking context, but it does not automatically reproduce every dependency or runtime prerequisite of the project.

Remember

  • Clone complete ≠ working automation environment; dependencies, secrets, submodules and generated state may still be absent.
  • Repository copied ≠ all history copied; shallow, filtered or single-branch clones intentionally omit objects or refs.
  • Checkout created ≠ desired branch current; remote refs may move after clone.
  • Authentication succeeded ≠ source trusted; repository provenance must be established separately.

First checks

  • git clone <url> — clone
  • git clone --depth 1 <url> — shallow (CI)
  • git clone --recurse-submodules <url> — with submodules

Verify in this order

remote → clone → local repo

Where it usually breaks

A successful clone proves that Git transferred enough repository data to create the requested local state; it does not prove a complete runtime or automation environment.

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

Clone 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=5467

Confirmation

Confirm action

Continue?