[git] Fix git stash alias,set default pull options
Fixed git stash alias (gsta) not correctly detecting zsh shell for git version guessing. Set default options to automatically rebase on pull, automatically prune on fetch, and automatically stash and squash on rebasing. Also made git diff highlight moved code.
This commit is contained in:
parent
86fa743988
commit
e9feecc440
2 changed files with 24 additions and 7 deletions
|
|
@ -47,14 +47,19 @@ if exist git; then
|
|||
|
||||
alias gst='git status'
|
||||
|
||||
if [ "$0" = "/bin/zsh" ]; then
|
||||
# if git is at least version 2.13, we can use git stash push
|
||||
# in shells other than zsh, simply fall back to save
|
||||
case "$(ps -cp "$$" -o command="")" in
|
||||
*zsh*)
|
||||
autoload -Uz is-at-least
|
||||
if is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')"; then
|
||||
alias gsta='git stash push'
|
||||
else
|
||||
alias gsta='git stash save'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*) alias gsta='git stash save' ;;
|
||||
esac
|
||||
alias gstp='git stash pop'
|
||||
alias gstl='git stash list'
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue