mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-12-12 20:21:02 +01:00
Use stash 'push' or 'save' depending on Git version
A utility function now parses the output of git --version and set the alias for git stash to 'git stash push' iff the current version of Git is greater than 2.13; it falls back to 'git stash save' otherwise.
This commit is contained in:
parent
b9670d0409
commit
308b046875
1 changed files with 6 additions and 1 deletions
|
@ -33,6 +33,11 @@ function work_in_progress() {
|
|||
fi
|
||||
}
|
||||
|
||||
function _omz_git_stash_command() {
|
||||
[[ `git --version 2>/dev/null` =~ '^git version ([[:digit:]]+.[[:digit:]]+)' && "$match[1]" >= '2.13' ]] \
|
||||
&& echo push || echo save
|
||||
}
|
||||
|
||||
#
|
||||
# Aliases
|
||||
# (sorted alphabetically)
|
||||
|
@ -238,7 +243,7 @@ alias gsps='git show --pretty=short --show-signature'
|
|||
alias gsr='git svn rebase'
|
||||
alias gss='git status -s'
|
||||
alias gst='git status'
|
||||
alias gsta='git stash save'
|
||||
alias gsta="git stash $(_omz_git_stash_command)"
|
||||
alias gstaa='git stash apply'
|
||||
alias gstc='git stash clear'
|
||||
alias gstd='git stash drop'
|
||||
|
|
Loading…
Reference in a new issue