Git Delete Remote Branch โ€“ How to Remove a Remote Branch in Git

ยท 110 words ยท 1 minute read

To show branches, use git branch. If you want to show all branches even the remote ones, use git branch -a.

To delete a branch, use git branch -d <branch-name>. If the branch name is refactor-feature-x, so the command will be git branch -d refactor-feature-x.

But this command deletes the local branch only. The branch on your local machine. What about deleting the remote branch? The branch on the remote machine/repo.

To delete the remote branch, just use this git command git push origin -d <branch-name>. If the branch name is refactor-feature-x, so the command will be git push origin -d refactor-feature-x.

I hope this helps. Share if you care.

Share:
waffarx cash back