GIT Delete Local Branch:
To delete a Git branch locally, you can use the git branch -d
command followed by the branch name:
git branch -d branch_name git branch -D branch_name // Deletes branch and does not care about merge status -D is : --delete --force
In the below example, we created dev_local and deleted branch
$ git branch * dev_local dev_v1 feature/new main $ git branch -d dev_local
GIT Delete Remote Branch
To delete a Git branch both locally and remotely, you can use the git push
command with the --delete
flag followed by the remote branch name:
git push origin --delete branch_name $ git branch dev_v1 feature/new * main $ git push origin --delete dev_v1