Git - push current branch shortcut


Is there a shortcut to tell Git to push the current tracking branch to origin?
Note: I know that I can change the default push behavior, but I am looking for an ad-hoc solution that does not change the default behavior.

For example, suppose I am on branch feature/123-sandbox-tests I would be using

git push origin feature/123-sandbox-tests

which is tedious. I am looking for a shortcut, something like

git push origin current # <- example, not working

where git knows that current is feature/123-sandbox-tests.

Edit: Starting from version 2.0, git's default behavior has changed to a more intuitive behavior, which is what I wanted to achieve. See This SO question for details.

Edit 2: ceztko's answer is the best answer as it allows to push the current branch, regardless of the settings.


According to git push documentation:

git push origin HEAD
    A handy way to push the current branch to the same name on the remote.

So I think what you need is git push origin HEAD. Also it can be useful git push -u origin HEAD to set upstream tracking information in the local branch, if you haven't already pushed to the origin.

How to permanently remove few commits from remote branch

How do I change the author and committer name/email for multiple commits?