git branch -d <branchname>
Delete a branch
This command is used to delete a specified branch in Git. It removes the specified branch from the local repository. -d
is a shortcut for --delete
.
If the branch has unmerged changes, the command will fail unless the --force
flag is used. Alternatively, you can use -D
which is a shortcut for --delete --force
.
It's important to note that this command can only be used to delete local branches and not remote branches. To delete a remote branch, you can use git push origin --delete <branchname>
.