Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

explain command for git delete remote branch

Tags:

git

The command to remove a remote branch in git is the following

git push origin :/heads/[feature-name]  
       [feature-name] being the name of the branch

This does the job perfectly, true that.
However by typing it, I can make no association that what I type is actually deleting a branch.

Can you please describe why this actually works? (my question has nothing to do with how it is implemented)

Understanding this, will hopefully help me get a better grasp of how git works.

like image 467
Dimitris Baltas Avatar asked Mar 15 '10 13:03

Dimitris Baltas


1 Answers

The format of git push (for our part) is :

git push <repository> <src>:<dst>

So using git push origin :/heads/[feature-name] says to git to push a empty branch to the feature-name branch of origin. So you clean it.

like image 191
mgautierfr Avatar answered Sep 19 '22 13:09

mgautierfr