200-901 · Question #538
200-901 Question #538: Real Exam Question with Answer & Explanation
The correct answer is D: git clone [url] - -branch feat145678909 - -single-branch. To clone a specific Git branch and restrict the clone to only that branch's history, the git clone command requires both the --branch and --single-branch options.
Question
A developer is working on an existing feature that needs enhancing. The primary production branch for the application is 'prim4a3b8c6d80374' and the branch for working on the feature is 'feat145678909'. The developer needs to create a clone of the single branch used for the feature that only has commits included in the current line of history. Which Git command must be used?
Options
- Agit clone [url] - -feat145678909 - -single-branch
- Bgit clone [url] - -branch feat145678909 - -single
- Cgit clone [url] - -single-branch feat145678909
- Dgit clone [url] - -branch feat145678909 - -single-branch
Explanation
To clone a specific Git branch and restrict the clone to only that branch's history, the git clone command requires both the --branch and --single-branch options.
Common mistakes.
- A. This option uses incorrect syntax for specifying the branch name directly after a double-hyphen, which is not how
git clone's--branchoption works. - B. The
--singleoption is not a valid Git command line option forgit clone; the correct option is--single-branch. - C. This option places the branch name as an argument to
--single-branch, but the branch name should be specified using the--branchoption.
Concept tested. Git clone single branch
Reference. https://git-scm.com/docs/git-clone
Topics
Community Discussion
No community discussion yet for this question.