Git Branch Creation and Checkout Commands
Short answer
C Use git checkout -b feature to create and switch to the new branch.
Question
master branch. Whichcommands create the new feature in a separate branch called
feature and check out the new version?Key Takeaways
The trap is forgetting that simply typing 'git checkout feature' fails if the branch doesn't exist; you must explicitly create it first or use the -b flag.
Learn how to correctly create a new Git branch and switch to it using the git checkout -b command in the 300-435 exam context.
Common mistake: Selecting an option that only creates the branch (e.g., git branch feature) without switching to it, leaving the engineer still on master.
Expert Analysis
The question asks for the Git commands to create a new branch named feature and immediately switch the working directory to that new branch. This is a standard two-step workflow often combined into one command in modern Git versions.
The correct sequence involves creating the branch and checking it out. The command git checkout -b feature performs both actions atomically: it creates a new branch named feature based on the current HEAD (which is master) and checks it out. Alternatively, one could use git branch feature followed by git checkout feature, but single-command options are preferred if available.
Looking at the likely structure of the image-based options:
- Option C is indicated as correct by community consensus and aligns with standard Git usage for this specific task.
- A common distractor might be
git checkout featurewithout the-bflag, which would fail if the branch does not exist yet. - Another distractor might be
git branch featurealone, which creates the branch but leaves the user onmaster.
Therefore, the decisive action is using git checkout -b feature or an equivalent combination that satisfies both creation and checkout requirements simultaneously.
Official Reference
https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow
This link opens the official vendor documentation in a new tab.
Exam Strategy
When dealing with Git questions in the 300-435 exam, always verify if the operation requires multiple steps. If the question asks to 'create AND check out,' look for the -b flag with checkout or separate branch/checkout commands. Memorize the shorthand syntax as it saves time and reduces error potential during the timed exam.
Frequently Asked Questions
What does the -b flag do in git checkout?
Can I create a branch without switching to it?
Community Votes
57% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 2 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 2
-
t567 👍 8Ans is C https://www.atlassian.com/git/tutorials/comparing-workflows/feature-branch-workflow
-
Dominican_Beard 👍 1The right answer is C
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All 300-435 Questions
Access 150 questions with complete answers and detailed explanations.
View Full 300-435 Practice Test →