Bird
0
0

Which Git command creates and switches to a local branch dev that tracks the remote branch origin/dev in one step?

easy📝 Syntax Q3 of 15
Git - Remote Repositories
Which Git command creates and switches to a local branch dev that tracks the remote branch origin/dev in one step?
Agit branch dev && git push -u origin dev
Bgit branch --track dev origin/dev && git checkout dev
Cgit checkout --track origin/dev
Dgit checkout -b dev origin/dev
Step-by-Step Solution
Solution:
  1. Step 1: Understand the command

    git checkout -b dev origin/dev creates a new local branch dev starting at origin/dev and switches to it.
  2. Step 2: Tracking setup

    This command also sets up the local branch to track the remote origin/dev.
  3. Final Answer:

    git checkout -b dev origin/dev -> Option D
  4. Quick Check:

    One command creates and switches with tracking. [OK]
Quick Trick: Use 'git checkout -b branch remote/branch' to track and switch [OK]
Common Mistakes:
  • Using separate branch and checkout commands without tracking
  • Using 'git checkout --track origin/dev' without branch name
  • Pushing before creating the local branch

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes