Bird
0
0

What will happen if you run git push origin --delete missing-branch when missing-branch does not exist on the remote?

medium📝 Command Output Q5 of 15
Git - Remote Repositories
What will happen if you run git push origin --delete missing-branch when missing-branch does not exist on the remote?
AGit will delete the local branch named <code>missing-branch</code> instead.
BGit will create a new empty branch named <code>missing-branch</code> on the remote.
CGit will silently succeed without any error or warning.
DGit will return an error indicating the remote branch does not exist.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the command

    The command attempts to delete a remote branch named missing-branch.
  2. Step 2: Check remote branch existence

    If the branch does not exist on the remote, Git cannot delete it.
  3. Step 3: Expected behavior

    Git will return an error message similar to error: unable to delete 'missing-branch': remote ref does not exist.
  4. Final Answer:

    Git will return an error indicating the remote branch does not exist. -> Option D
  5. Quick Check:

    Deleting non-existent remote branches causes an error [OK]
Quick Trick: Deleting non-existent remote branches triggers an error [OK]
Common Mistakes:
  • Assuming the command creates a branch if missing
  • Expecting silent success without error
  • Confusing remote deletion with local branch deletion

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes