Why Git Uses (:
) to Delete Remote Branch
It would appear that the colon in
git push origin :<branch-to-delete> is used exclusively to delete branches. But such is not the case.
The format for the refspec is*:
This tells Git to push the
source branch to the
destination branch in remote. So if the
source is blank, we get a leading colon. This has the effect of deleting the
destination branch. Its like saying “push null pointer to destination”.
*You can learn more about the refspec in its entirety in this Stack Overflow