Last Updated: February 25, 2016
·
631
· keithwoody

git helper for long branch names

Stole this idea from Giles Bowkett. Create a bash or zsh function called this for fast easy pushes of topic branches with long names a'la:

$ git push origin `this`

bash:

function this(){
    if [[ -d '.git' ]]; then
        git branch  | grep \* | cut -d ' ' -f 2
    fi
}

zsh (may require git plugin, still new to zsh):

this() { if [[ -d '.git' ]] then; current_branch; fi }