Delete a Remote Branch

Learn to delete a remote branch.

Deletion using the git push command

We can delete a remote branch named new_branch using a git push command as in the example given below:

$ git push origin :new_branch

Note: Remember to type the colon (:) when doing this.

Branch names

According to the specification, we don’t necessarily give the local and remote branches the same name.

$ git push <remote name> <local branch name>:<remote branch name> 

For example:

$ git push origin new_styles:dev_styles

Our local branch may not meet the team standard convention. We can rename it when we push it to the remote branch.

Get hands-on with 1400+ tech skills courses.