Nono.MA

Delete a remote Git branch

SEPTEMBER 2, 2022

Here's how to remove a remote Git branch without using an app or a website user interface, say, GitHub or GitLab.

# Delete a remote Git Branch (assuming your remote is called origin)
git push origin --delete your-branch-name
# To bitbucket.org:nonoesp/some-repo.git
#  - [deleted]         your-branch-name

Remember that you will also have to delete the Git branch from your local repository as follows.

# Delete a local branch
# -d is a shorthand for --delete
git branch -d your-branch-name
# Deleted branch your-branch-name (was f9b622c).

# Force delete a local branch (regardless of the branch merge status)
# -D is a shorthand for --delete --force
git branch -D your-branch-name
# Deleted branch your-branch-name (was f9b622c).

BlogCodeGit