200-901 · Question #294
Refer to the exhibit. What does the command marked (2) do when it is run?
The correct answer is C. It deletes the "test" branch. The command shown in the exhibit is 'git branch -D test'. The '-D' flag (uppercase) is a force-delete option in Git. It deletes the specified branch ('test') immediately, regardless of whether the branch has been merged into another branch. This is distinct from '-d'…
Question
Refer to the exhibit. What does the command marked (2) do when it is run?
Exhibit
Options
- AIt duplicates the "test" branch.
- BIt deletes the "test" branch only if a new branch is created.
- CIt deletes the "test" branch.
- DIt does not delete the branch until it is merged.
How the community answered
(56 responses)- A2% (1)
- B2% (1)
- C91% (51)
- D5% (3)
Explanation
The command shown in the exhibit is 'git branch -D test'. The '-D' flag (uppercase) is a force-delete option in Git. It deletes the specified branch ('test') immediately, regardless of whether the branch has been merged into another branch. This is distinct from '-d' (lowercase), which is a safe delete that refuses to delete a branch if it contains commits not yet merged. Answer D describes the behavior of 'git branch -d' (safe delete), not '-D'. Answer B is incorrect - branch deletion does not depend on creating a new branch. Answer A is incorrect - '-D' deletes, not duplicates. Use '-D' when you are certain you want to remove the branch regardless of merge status.
Topics
Community Discussion
No community discussion yet for this question.
