Predict Branch Delete
Predict Output Medium
Question
You merged feature into main, then run `git branch -d feature`. What happens?
Code
git checkout main
git merge feature
git branch -d feature
Hint
-d only deletes fully merged branches.
Explanation
git branch -d feature deletes the feature branch because it has been fully merged into main. Git prints 'Deleted branch feature (was <hash>)'. The -d flag (lowercase) refuses to delete unmerged branches; -D (uppercase) forces deletion regardless of merge status.
Related Resources
Related Lessons
Related Cheatsheets
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.