DEV Community

Cover image for How to delete multiple git branches locally and remotely?
Martins Gouveia
Martins Gouveia

Posted on

1

How to delete multiple git branches locally and remotely?

To delete multiple Git branches locally, you can use the following command in the terminal:

git branch -d branch1 branch2 branch3
Enter fullscreen mode Exit fullscreen mode

This will delete the locally specified branches. If any branches have not been merged, you will need to use -D instead of -d to force the deletion.

To delete the same branches remotely, you can use:

git push origin --delete branch1 branch2 branch3
Enter fullscreen mode Exit fullscreen mode

Make sure to replace "branch1", "branch2" and "branch3" with the actual names of your branches. This removes branches both locally and in the remote repository.

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay