CompTIA Linux+ (XK0-004) — Question 300
An administrator clones a Git repository onto a local laptop. While inspecting the code, the administrator notices a bug and wants to fix it. Which of the following is the BEST command for the administrator to use to test a patch for the script prior to updating the version saved in master?
Answer options
- A. init
- B. branch
- C. stash
- D. commit
- E. merge
Correct answer: B
Explanation
Using the 'branch' command allows the administrator to create a separate branch for testing the patch, which keeps the master branch unchanged. The other options do not facilitate testing changes in isolation: 'init' initializes a new repository, 'stash' temporarily saves changes, 'commit' saves changes to the current branch, and 'merge' combines branches.