How to delete a local branch?

git branch -D branch_name

To delete a local branch called branch_name use git branch -D branch_name.

With paramater -D a branch is removed even if the changes in it were not merged.

Layer 1
Terminal Example
git branch -v
* main       16f0fe7 Adding image.png and README.md
  new_branch 0b6699a Update README
git branch -D new_branch
Deleted branch new_branch (was 0b6699a).
git branch -v
* main       16f0fe7 Adding image.png and README.md

See git branch to learn more about it.

Last modified on November 30, 2021.

You might also like