To create and switch to a new branch called "my-bug-fix" in Git, you use the git checkout -b command. This command creates the branch and switches to it in one step.
A. git checkout -b my-bug-fix - Correct. This command creates a new branch and switches to it. B. git branch -b my-bug-fix - Incorrect. The -b option is not valid with git branch. C. git branch my-bug-fix - This creates a new branch but does not switch to it. D. git checkout my-bug-fix - This switches to an existing branch but does not create a new one.
References:
Git Branching - Creating a Branch
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit