Which Git Command Creates an Infrastructure as Code Snapshot?
Short answer
D git tag
Question
Key Takeaways
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.
Common mistake: 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.
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
These links open the official vendor documentation in a new tab.
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.'
Community Votes
75% of anonymous learners picked answer D. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 4 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 4
-
NastyNutsu 👍 3 Answered DA. 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 Answered CA 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.
-
Eikan 👍 1 Answered DAgreed. Tagging is synonymous is with the snapshot feature.
-
Alex818119 👍 2 Answered DAI says D so D
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.