Git Delete Local Branch
You can delete a Git Branch using the -d
option
$ git branch -d <branch_name>
According to the Git documentation, -d
is the shorthand for --delete
, so both options are acceptable.
$ git branch --delete <branch_name>
If you want to delete the branch irrespective of the merged status, use the -D
option
$ git branch -D <branch_name>
Here’s the complete Git documentation about deleting branches
OPTIONS
-d, --delete
Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if no upstream was set with --track or --set-upstream-to.
-D
Shortcut for --delete --force.
-f, --force
In combination with -d (or --delete), allow deleting the branch irrespective of its merged status.