Skip to content
Home » How to delete Local Git Branch

How to delete Local Git Branch

Use any of the commands below to delete the Local Git Branch that best suits your needs. To remove local git branch follow one of the below commands.

git branch -D <name_of_branch>
git branch -d <name_of_branch>

Here -D and -d works as explained below :

  1. The -D flag in the above code is an alias for --delete --force, which helps to delete the branch regardless of its merged status.
  2. The -d option in the above code is an alias for --delete, which deletes the branch only if the branch has been fully merged in it’s upstream previously.
  3. If you try to attempt to delete the present chosen branch, you will caught up with an error.

Also Read:

How to Delete Remote Git Branch