The push command has the form of
1 | git push remote_name source_ref:destination_ref |
Example:
1 | git push origin +branch42:branch42 |
The plus is optional and allows non-fast-forward updates.
Alternate syntax is
1 | git push -f origin branch42 |
if you omit the destination, it’s implied that it’s the same name. If tracking is set up to a particular branch on the remote it will go to that one. The -f is –force.
Deleting branches has 2 syntaxes, the old:
1 | git push -f origin :branch42 |
and
1 | git push --delete origin branch42 |
The first is read as “push nothing into branch42” which deletes it.
One trick is that if you specify . as the remote name, it implies the current repo as the remote. This can be used for updating a local branch without having to check it out:
1 | git push . origin/master:master |
will update master without having to checkout master.