This command is used to interact with the branches. Without any additional flags or parameters, it simply lists all local branches in the current repository.
By specifying a branch name following git branch
, for instance git branch <branch_name>
, a new branch is created with that name.
If used with the -d
or --delete
flag alongside a branch name, it attempts to delete the specified branch, for instance git branch -d <branch_name>
. For a force delete, irrespective of the merge status of the branch, use -D
which is a shortcut for --delete --force
.