Which Git Command Creates an Infrastructure as Code Snapshot?

A DevOps engineer wants to work on a snapshot of the infrastructure as code configuration. Which of the following commands should the engineer use to accomplish this task?

  1. git pull
  2. git push
  3. git branch
  4. git tag Source Reference Answer

Community Votes

D
75%
C
25%

75% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The exam tests whether candidates can distinguish between Git branches (working copies) and tags (point-in-time snapshots); the trap is confusing git branch with git tag.

The XK0-005 question tests knowledge of Git commands for creating snapshots of infrastructure as code. Community consensus heavily favors git tag as the correct answer, associating tags with immutable snapshots.

Many candidates choose git branch (C) because creating a branch feels like making a working copy, but the keyword 'snapshot' specifically points to git tag as the intended answer.

Community Discussion (4 comments)

Alex818119 👍 2 Selected: D
AI says D so D
Eikan 👍 1 Selected: D
Agreed. Tagging is synonymous is with the snapshot feature.
NastyNutsu 👍 3 Selected: D
A. git pull is used for fetch and merge changes from a remote repository into the current branch in your local repository. B. git push is used to upload your local repository content to a remote repository. C. git branch is used to list, create, or delete branches in your repository git branch new-branch -- create a new branch git branch -- list all branch D. git tag is used to create a snapshot or a tag in the repository's history. tags are often used to mark important points, such as releases or versions.
jimr999 👍 2 Selected: C
A tag is just a marker within the code. It makes sense that instead the developer here would want to create a branch to work on.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

The suggested answer is git tag (D). In Git terminology, a tag is a named reference to a specific commit, effectively acting as a read-only snapshot of the repository at a point in time. Community comment [3] explicitly states, 'Tagging is synonymous with the snapshot feature,' reinforcing this interpretation. Comment [1] also confirms that git tag is used to create a snapshot of the codebase. For DevOps engineers working with infrastructure as code, tagging a release or configuration state is the standard way to preserve an immutable baseline.

Why the Other Options Are Wrong

git pull (A) fetches and merges remote changes — it modifies the working tree rather than preserving a snapshot. git push (B) uploads local commits to a remote repository and does not create any local snapshot marker. git branch (C) creates a new line of development, but branches are mutable and intended for ongoing work, not static snapshots. Comment [2] argues for branches, but the question's wording — 'snapshot' — specifically targets tags, which are designed to be immutable markers.

Community Comment Notes

The vote split is 75 for D and 25 for C, indicating strong but not unanimous agreement. Comment [2] is the primary dissent, arguing that a developer would 'want to create a branch to work on.' However, comments [1], [3], and [4] all support D, with [3] directly linking 'tag' to 'snapshot.' The consensus aligns with the suggested answer, though the ambiguity in the question wording ('work on a snapshot') may have misled some candidates toward git branch.

Official Reference

Exam Strategy

When CompTIA uses the word 'snapshot' in a Git context, think 'tag' — tags are immutable point-in-time markers. If the question says 'work on a copy' or 'isolate changes,' then think 'branch.'

Related Analysis

← Back to XK0-005 Study Guide