How do I delete a Git branch locally and remotely?

Created by Matthew RankinLinked to 33.8m issues across 165 teams

tl;dr

To delete a Git branch locally and remotely in Javascript, you can use the git branch -d command. This command will delete the branch locally, and then you can use the git push origin --delete <branch_name> command to delete the branch remotely.

For example, if you wanted to delete a branch called my_branch, you would run the following commands:

git branch -d my_branch git push origin --delete my_branch
We use cookies to personalize content
run ads, and analyze traffic.