Delete a merged branch
Description: The branch feature-menu is merged into main. Show the merged branches and delete it.
Hint:
git branch --mergedlists merged branches.-dis the safe delete.
Solution
Terminal output
$ git branch –merged
feature-menu
* main
$ git branch -d feature-menu
Deleted branch feature-menu (was cda1bfa).
$ git branch
* main
How it works
- The safe delete
-dworks only when the branch is merged. Otherwise Git refuses. - The commit is not lost, because it is already part of
main.
Read Git Branch.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |