nerdexam
CompTIACompTIA

XK0-005 · Question #1341

XK0-005 Question #1341: Real Exam Question with Answer & Explanation

The correct answer is A: Init. To safely develop and test a bug fix without immediately affecting the main master branch in Git, the best practice is to create a new branch.

System Management

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

Explanation

To safely develop and test a bug fix without immediately affecting the main master branch in Git, the best practice is to create a new branch.

Common mistakes.

  • A. git init initializes a new Git repository in the current directory, which is not applicable when working within an already cloned repository to test a patch.
  • C. git stash temporarily saves uncommitted changes to clean the working directory, but it does not create a dedicated development line for a fix or allow for isolated testing.
  • D. git commit records changes into the current branch's history; if on the master branch, this would directly update its version without prior isolation for testing.
  • E. git merge is used to integrate changes from one branch into another, which is typically done after a fix has been developed and tested on a separate branch, not for the initial isolation.

Concept tested. Git branching for feature development/bug fixes

Reference. https://git-scm.com/docs/git-branch

Topics

#Git#Version Control#Repository Management#Command Line Interface

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions