How To Delete Remote Branch In Git?

Git uses remote branches which are also called remote references. Remote branches are located in the remote repositories and not stored in the local system. But we can delete the remote branch in Git without storing it locally.

List Remote Git Branchs

Before deleting a remote branch listing it is very beneficial. The git branch -a command can be used to list remote git branches. This lists all remote branches and their hash values with head information.

$ git branch -a
List Remote Git Branchs

Delete Remote Git Branch

The remote branch can be deleted with the git push command by providing the --delete option and the remote branch name. In the following example, we delete the remote branch named origin/master .

$ git push origin --delete master

Leave a Comment