Bird
0
0

Why is it recommended to use git push origin --delete branch-name instead of git push origin :branch-name to delete remote branches?

hard📝 Conceptual Q10 of 15
Git - Remote Repositories
Why is it recommended to use git push origin --delete branch-name instead of git push origin :branch-name to delete remote branches?
ABecause '--delete' is clearer and less error-prone syntax
BBecause ':branch-name' creates a new branch instead of deleting
CBecause '--delete' deletes local branches too
DBecause ':branch-name' only works on local branches
Step-by-Step Solution
Solution:
  1. Step 1: Compare the two syntaxes

    git push origin --delete branch-name is explicit and easier to understand than the older git push origin :branch-name syntax.
  2. Step 2: Understand why clarity matters

    Clear syntax reduces mistakes and improves readability, making '--delete' preferred.
  3. Final Answer:

    '--delete' is clearer and less error-prone syntax -> Option A
  4. Quick Check:

    Use '--delete' for clarity and safety [OK]
Quick Trick: Prefer '--delete' flag for safer remote branch deletion [OK]
Common Mistakes:
  • Thinking ':branch-name' creates branches
  • Assuming '--delete' affects local branches
  • Confusing local and remote branch commands

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes