nerdexam
Cisco

350-901 · Question #77

A developer plans to create a new bugfix branch to fix a bug that was found on the release branch. Which command completes the task?

The correct answer is C. git checkout -b BUG FIX RELEASE. To create a new branch from an existing one in Git, the git checkout -b <new-branch-name> <starting-point-branch> command is used.

Software Development and Design

Question

A developer plans to create a new bugfix branch to fix a bug that was found on the release branch. Which command completes the task?

Options

  • Agit checkout -b RELEASE BUGFIX
  • Bgit checkout -t BUGFIX RELEASE
  • Cgit checkout -b BUG FIX RELEASE
  • Dgit checkout -t RELEASE BUGFIX

How the community answered

(36 responses)
  • B
    3% (1)
  • C
    94% (34)
  • D
    3% (1)

Why each option

To create a new branch from an existing one in Git, the `git checkout -b <new-branch-name> <starting-point-branch>` command is used.

Agit checkout -b RELEASE BUGFIX

The arguments are in the wrong order; `RELEASE` is given as the new branch name and `BUGFIX` as the starting point, which is incorrect.

Bgit checkout -t BUGFIX RELEASE

The `-t` (or --track) option is used to set up tracking for a remote branch, not to create a new local branch from another local branch.

Cgit checkout -b BUG FIX RELEASECorrect

The command `git checkout -b BUGFIX RELEASE` correctly creates a new branch named `BUGFIX` and switches to it, using the current state of the `RELEASE` branch as its starting point.

Dgit checkout -t RELEASE BUGFIX

Similar to B, `-t` is for tracking remote branches and the order of arguments is incorrect for creating a local branch from another.

Concept tested: Git branch creation from an existing branch

Source: https://git-scm.com/docs/git-checkout#_create_new_branches

Topics

#Git branching#Version control#Software development workflow

Community Discussion

No community discussion yet for this question.

Full 350-901 Practice