Patricio Treviño · 21 June, 2018 · 2 min read
Delete a local git branch using the terminal
Syntax
|
git branch <[-D | -d | --delete]> <branch> |
Option |
Description |
option |
The delete option to be used. |
branch |
The local branch to be deleted. |
Note: valid options are:
-D, forces the deletion of the local branch even if there are pending merges.
-d, is a synonym of --delete.
--delete, deletes the local branch with no pending merges.
Example
|
# deletes local branch "my-branch" |
|
git branch --delete my-branch |
|
|
|
# same as above |
|
git branch -d my-branch |
|
|
|
# forces the deletion of the local branch "my-branch" |
|
git branch -D my-branch |
References
git-branch