Created
May 14, 2015 07:13
-
-
Save scue/bd83c6d621266b0b02f8 to your computer and use it in GitHub Desktop.
Windows Git Bash ~/.bashrc file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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