Challenge - 5 Problems
Branch Deletion Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate1:30remaining
Output of deleting a local branch
What is the output of the command
git branch -d feature1 if the branch feature1 has been fully merged into main?Git
git branch -d feature1Attempts:
2 left
💡 Hint
Deleting a branch that is fully merged succeeds with a confirmation message.
✗ Incorrect
The
-d option deletes a local branch only if it is fully merged. The output confirms deletion with the branch name and commit hash.💻 Command Output
intermediate1:30remaining
Error when deleting unmerged local branch
What error message appears when running
git branch -d feature2 if feature2 has unmerged changes?Git
git branch -d feature2Attempts:
2 left
💡 Hint
The
-d option refuses to delete branches with unmerged changes.✗ Incorrect
Git prevents deleting branches with unmerged changes using
-d to avoid data loss. It shows an error message.💻 Command Output
advanced1:30remaining
Deleting a remote branch output
What is the output of the command
git push origin --delete feature3 when the remote branch feature3 exists and is deleted successfully?Git
git push origin --delete feature3Attempts:
2 left
💡 Hint
Successful remote deletion shows the branch name with [deleted].
✗ Incorrect
The output confirms deletion on the remote with the branch name and [deleted] marker.
❓ Troubleshoot
advanced2:00remaining
Troubleshooting remote branch deletion failure
You run
git push origin --delete feature4 but get the error error: unable to delete 'feature4': remote ref does not exist. What is the most likely cause?Attempts:
2 left
💡 Hint
The error says the remote ref does not exist.
✗ Incorrect
This error means the branch name is not found on the remote. It may have been deleted already or never pushed.
✅ Best Practice
expert2:30remaining
Best practice for safely deleting branches
Which option describes the safest practice to delete a local branch that might have unmerged work?
Attempts:
2 left
💡 Hint
Safe deletion avoids losing unmerged work.
✗ Incorrect
Using
-d checks if the branch is merged and prevents accidental data loss. Force deleting with -D can lose work.