Skip to content

Help us create more tutorials! Make a donation using the Donate button or become a member using the button below to hide this banner and track your progress.

Delete a branch – Git


To delete a branch in Git, enter the following command in your terminal:

git branch -d branch-name


Before you run the above command, make sure you’re on a different branch than the one you’re trying to delete. You can switch branches by entering the following command in your terminal:

git checkout other-branch

After running the delete command, you should see something similar to the following output:

Deleted branch branch-name (was 1f0de91).


Use the following command to delete the dev-branch:

git branch -d dev-branch


Basic Branching and Merging from the Pro Git book

Back to: Git Course > Git Intermediate