GIT: Delete a remote branch

From everyday work

Prasanna Wijesiriwardana
1 min readJun 18, 2020
https://git-scm.com/downloads/logos
Source: https://git-scm.com/downloads/logos

A GIT repository supports branches that enables developers to implement new features or fix bugs by isolating the WIP code from the main branch. It is recommended to delete the unused branches to keep the code repository clutter free.

Delete local branch

git branch -d <branchname>

-d option deletes the local branch if its already pushed to the remote branch, if you wants to delete a local branch which hasn’t been pushed to remote, -D option can be used to force the deletion

Delete remote branch

git push <remote> --delete <branchname>

--

--