[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:
Marty Oehme 2020-05-25 17:36:27 +02:00
parent 86fa743988
commit e9feecc440
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A
2 changed files with 24 additions and 7 deletions

View file

@ -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