I am configuring Gerrit
and I would like to avoid writing:
git push gerrit HEAD:refs/for/master
I would like to write:
You might also be interested in git-review, which not only eliminates the push
by simply providing for:
git review
... but also lets you do things like:
git review branchname
Checkout the Usage section on the link above for more.
What you're best off doing is a Git scriptlet in your alias. Something like this works based on the 'upstream' branch, although I'd like to clean this up a little bit still:
[alias]
pub = "!f() { git push -u ${1:-origin} HEAD:`git config branch.$(git name-rev --name-only HEAD).merge | sed -e 's@refs/heads/@refs/for/@'`; }; f"
This way, you can simply type:
git pub
and it's just like you typed:
git push -u origin HEAD:refs/for/master
or
git push -u origin HEAD:refs/for/myremote-branch
The only requirement for this is that it is only compatible with the Git Bash shell on Windows, or one of the many Linux shells.