Right now when i commit and want to push and create remote branch I did:
app_folder (some_branch)> git push -u origin some_branch:some_branch
Is there a way to write zsh alias ex: gpu
which get name of current branch and do that without my help?
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.