Here's a very basic script. Some additional features (and error checking!) are probably needed, but it works:
#!/bin/zsh
function branch() {
ref=$(git symbolic-ref HEAD)
echo "${ref#refs/heads/}"
}
# TODO: Let the user set the remote to push to?
git push -u origin ${branch}:${branch}
The branch()
function is taken from Oh-My-ZSH git_prompt_info()
- it's used to put the current git branch
into the PROMPT
.
This would probably work rather well as a zsh
function, rather than an alias.