Skip to content

Instantly share code, notes, and snippets.

@scue
Created May 14, 2015 07:13
Show Gist options
  • Save scue/bd83c6d621266b0b02f8 to your computer and use it in GitHub Desktop.
Save scue/bd83c6d621266b0b02f8 to your computer and use it in GitHub Desktop.
Windows Git Bash ~/.bashrc file
function _gmto()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
COMPREPLY=( $(compgen -W "$(git branch | sed '/\*/d' | xargs echo)" -- ${cur}) )
return 0
}
case $SHELL in
'/bin/bash' )
complete -F _gmto gmto
;;
'/bin/zsh' )
compdef gmto=git-branch
;;
esac
# git merge to branch
gmto(){
local oldbranch=$(current_branch)
local mergeto=$1
git checkout $mergeto
git merge $oldbranch
git checkout $oldbranch
}
test -e ~/.bash_aliases.git && . ~/.bash_aliases.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment