XK0-005 · Question #346
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…
The correct answer is B. Branch. This question asks for the Git command used to create a separate line of development for testing changes without affecting the main branch.
Question
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 prior to updating the version saved in master?
Options
- AInit
- BBranch
- CStash
- DComit
- Emerge
How the community answered
(42 responses)- A5% (2)
- B90% (38)
- D2% (1)
- E2% (1)
Why each option
This question asks for the Git command used to create a separate line of development for testing changes without affecting the main branch.
git init initializes a new Git repository, which is not applicable here as the repository is already cloned.
The `git branch` command is the best choice because it allows the administrator to create a new, isolated line of development from the master branch. This enables testing and fixing bugs in a dedicated environment without directly impacting the stable master branch, and the changes can be merged later after verification.
git stash temporarily saves changes that are not ready to be committed, allowing the user to switch branches or perform other operations, but it doesn't create a new line of development.
git commit records changes to the repository's history on the current branch, which would directly affect the master branch if the bug fix were committed there.
git merge combines changes from one branch into another, which is typically done after a bug fix has been developed and tested on a separate branch, not as the initial step to test a patch.
Concept tested: Git branching for isolated development
Source: https://git-scm.com/docs/git-branch
Topics
Community Discussion
No community discussion yet for this question.