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>
-d works as explained below :
-Dflag in the above code is an alias for
--delete --force, which helps to delete the branch regardless of its merged status.
-doption 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.
- If you try to attempt to delete the present chosen branch, you will caught up with an error.