summaryrefslogtreecommitdiff
path: root/plugins/git/git.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/git/git.plugin.zsh')
-rw-r--r--plugins/git/git.plugin.zsh33
1 files changed, 14 insertions, 19 deletions
diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
index 4f2745038..b851fb97d 100644
--- a/plugins/git/git.plugin.zsh
+++ b/plugins/git/git.plugin.zsh
@@ -6,19 +6,12 @@ zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
# Functions
#
-# The current branch name
-# Usage example: git pull origin $(current_branch)
-# Using '--quiet' with 'symbolic-ref' will not cause a fatal error (128) if
-# it's not a symbolic ref, but in a Git repo.
+# The name of the current branch
+# Back-compatibility wrapper for when this function was defined here in
+# the plugin, before being pulled in to core lib/git.zsh as git_current_branch()
+# to fix the core -> git plugin dependency.
function current_branch() {
- local ref
- ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null)
- local ret=$?
- if [[ $ret != 0 ]]; then
- [[ $ret == 128 ]] && return # no git repo.
- ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return
- fi
- echo ${ref#refs/heads/}
+ git_current_branch
}
# The list of remotes
function current_repository() {
@@ -99,7 +92,7 @@ alias gfo='git fetch origin'
alias gg='git gui citool'
alias gga='git gui citool --amend'
ggf() {
-[[ "$#" != 1 ]] && local b="$(current_branch)"
+[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force origin "${b:=$1}"
}
compdef _git ggf=git-checkout
@@ -107,23 +100,23 @@ ggl() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
git pull origin "${*}"
else
-[[ "$#" == 0 ]] && local b="$(current_branch)"
+[[ "$#" == 0 ]] && local b="$(git_current_branch)"
git pull origin "${b:=$1}"
fi
}
compdef _git ggl=git-checkout
-alias ggpull='git pull origin $(current_branch)'
+alias ggpull='git pull origin $(git_current_branch)'
compdef _git ggpull=git-checkout
ggp() {
if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
git push origin "${*}"
else
-[[ "$#" == 0 ]] && local b="$(current_branch)"
+[[ "$#" == 0 ]] && local b="$(git_current_branch)"
git push origin "${b:=$1}"
fi
}
compdef _git ggp=git-checkout
-alias ggpush='git push origin $(current_branch)'
+alias ggpush='git push origin $(git_current_branch)'
compdef _git ggpush=git-checkout
ggpnp() {
if [[ "$#" == 0 ]]; then
@@ -133,9 +126,9 @@ ggl "${*}" && ggp "${*}"
fi
}
compdef _git ggpnp=git-checkout
-alias ggsup='git branch --set-upstream-to=origin/$(current_branch)'
+alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
ggu() {
-[[ "$#" != 1 ]] && local b="$(current_branch)"
+[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git pull --rebase origin "${b:=$1}"
}
compdef _git ggu=git-checkout
@@ -212,11 +205,13 @@ alias gsts='git stash show --text'
alias gsu='git submodule update'
alias gts='git tag -s'
+alias gtv='git tag | sort -V'
alias gunignore='git update-index --no-assume-unchanged'
alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1'
alias gup='git pull --rebase'
alias gupv='git pull --rebase -v'
+alias glum='git pull upstream master'
alias gvt='git verify-tag'