Git – Delete Both Local and Remote Branch

Deleting branches in Git is something done frequently, especially in GitFlow. Here are commands to delete local and remote branches.

Remove a local branch from your machine

git branch -d {the_local_branch_name}

(use -D instead to force deletion, without checking merged status)

Remove a remote branch from the server

git push origin --delete {the_remote_branch_name}

Leave a Comment