Developing Applications and Automating Workflows Using Cisco Platforms (DEVASC) — Question 162
How does a developer create and switch to a new branch called `my-bug-fix` to develop a product fix?
Answer options
- A. git checkout -b my-bug-fix
- B. git branch -b my-bug-fix
- C. git branch my-bug-fix
- D. git checkout my-bug-fix
Correct answer: A
Explanation
The command 'git checkout -b my-bug-fix' is correct as it simultaneously creates the new branch and switches to it. The option 'git branch -b my-bug-fix' is incorrect because 'git branch' does not have a '-b' option. 'git branch my-bug-fix' creates the branch but does not switch to it, and 'git checkout my-bug-fix' would switch to an existing branch without creating a new one.