The command to delete a remote git branch has the following syntax:
# git 1.7+ git push <remote_name> --delete <branch_name> # or the shorter version git push <remote_name> -d <branch_name>
For git 1.5+, the syntax slightly differs:
# git 1.5+ git push <remote_name> :<branch_name>
For example, if "
origin" is the remote name, and "
foo" is the branch you wish to delete, then you would use the following command:
# git 1.7+ git push origin --delete foo # or the shorter version git push origin -d foo
And in git 1.5, you would, for example, use the following command:
# git 1.5+ git push origin :foo
Please note that these commands do not delete the local branch. Deleting a local branch is done using an entirely different command.
This post was published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing. Please show your love and support by sharing this post.