Bird
0
0

You want to push a new branch feature2 to remote origin and set it as the default upstream branch for future pushes. Which command achieves this in one step?

hard📝 Application Q8 of 15
Git - Remote Repositories
You want to push a new branch feature2 to remote origin and set it as the default upstream branch for future pushes. Which command achieves this in one step?
Agit push -u origin feature2
Bgit push origin feature2
Cgit push origin --set-upstream feature2
Dgit push origin -u feature2
Step-by-Step Solution
Solution:
  1. Step 1: Understand setting upstream branch

    The -u or --set-upstream flag sets the remote branch as upstream for the local branch.
  2. Step 2: Correct command syntax

    The correct syntax is git push -u origin feature2. Options like git push origin --set-upstream feature2 and git push origin -u feature2 have wrong flag position.
  3. Final Answer:

    git push -u origin feature2 -> Option A
  4. Quick Check:

    Use -u flag to set upstream on push [OK]
Quick Trick: Use git push -u to set upstream branch [OK]
Common Mistakes:
  • Placing -u flag after remote name incorrectly
  • Omitting -u and expecting upstream set
  • Using --set-upstream incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes