Learn the correct Git command for cloning a single branch. Understand the use of –branch and –single-branch options in Git clone command.
Table of Contents
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?
A. git clone [url] – -feat145678909 – -single-branch
B. git clone [url] – -branch feat145678909 – -single
C. git clone [url] – -single-branch feat145678909
D. git clone [url] – -branch feat145678909 – -single-branch
Answer
D. git clone [url] – -branch feat145678909 – -single-branch
Explanation
This command clones the repository located at [url], but only includes the history of the branch feat145678909. The –branch option specifies the branch to clone, and the –single-branch option tells Git to only include the history of that branch.
Cisco 200-901 certification exam practice question and answer (Q&A) dump with detail explanation and reference available free, helpful to pass the Cisco 200-901 exam and earn Cisco 200-901 certification.