General syntax

git push <remotename> <object>:<remotebranchname>

Example

git push origin master:wip-yourname

Will push your master branch to the wip-yourname branch of origin (most of the time, the repository you cloned from).


Delete remote branch

Deleting the remote branch is the equivalent of pushing an empty object to it.

git push <remotename> :<remotebranchname>

Example

git push origin :wip-yourname

Will delete the remote branch wip-yourname

Instead of using the colon, you can also use the –delete flag, which is better readable in some cases.

Example

git push origin --delete wip-yourname

Push a single commit

If you have a single commit in your branch that you want to push to a remote without pushing anything else, you can use the following

git push <remotename> <commit SHA>:<remotebranchname>

Example