9eaf51107f15011f73b39fb727895f65797edcbc
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
2index e42e096883ec829c52c562b188717c4f177e6d6c..d59e0ca9f92f2a09e455299afa4c4b4e24427af1 100644
3--- a/plugins/git/git.plugin.zsh
4+++ b/plugins/git/git.plugin.zsh
5@@ -1,7 +1,6 @@
6 # Query/use custom command for `git`.
7-local git_cmd
8-zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd
9-: ${git_cmd:=git}
10+zstyle -s ":vcs_info:git:*:-all-" "command" _omz_git_git_cmd
11+: ${_omz_git_git_cmd:=git}
12
13 #
14 # Functions
15@@ -13,20 +12,20 @@ zstyle -s ":vcs_info:git:*:-all-" "command" git_cmd
16 # it's not a symbolic ref, but in a Git repo.
17 function current_branch() {
18 local ref
19- ref=$($git_cmd symbolic-ref --quiet HEAD 2> /dev/null)
20+ ref=$($_omz_git_git_cmd symbolic-ref --quiet HEAD 2> /dev/null)
21 local ret=$?
22 if [[ $ret != 0 ]]; then
23 [[ $ret == 128 ]] && return # no git repo.
24- ref=$($git_cmd rev-parse --short HEAD 2> /dev/null) || return
25+ ref=$($_omz_git_git_cmd rev-parse --short HEAD 2> /dev/null) || return
26 fi
27 echo ${ref#refs/heads/}
28 }
29 # The list of remotes
30 function current_repository() {
31- if ! $git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
32+ if ! $_omz_git_git_cmd rev-parse --is-inside-work-tree &> /dev/null; then
33 return
34 fi
35- echo $($git_cmd remote -v | cut -d':' -f 2)
36+ echo $($_omz_git_git_cmd remote -v | cut -d':' -f 2)
37 }
38 # Pretty log messages
39 function _git_log_prettily(){
40@@ -49,6 +48,8 @@ function work_in_progress() {
41 alias g='git'
42
43 alias ga='git add'
44+alias gaa='git add --all'
45+alias gapa='git add --patch'
46
47 alias gb='git branch'
48 alias gba='git branch -a'
49@@ -80,7 +81,7 @@ alias gcp='git cherry-pick'
50 alias gcs='git commit -S'
51
52 alias gd='git diff'
53-alias gdc='git diff --cached'
54+alias gdca='git diff --cached'
55 alias gdt='git diff-tree --no-commit-id --name-only -r'
56 gdv() { git diff -w "$@" | view - }
57 compdef _git gdv=git-diff
58@@ -95,30 +96,44 @@ alias gfo='git fetch origin'
59 alias gg='git gui citool'
60 alias gga='git gui citool --amend'
61 ggf() {
62-[[ "$#" != 1 ]] && b="$(current_branch)"
63+[[ "$#" != 1 ]] && local b="$(current_branch)"
64 git push --force origin "${b:=$1}"
65 }
66 compdef _git ggf=git-checkout
67 ggl() {
68-[[ "$#" != 1 ]] && b="$(current_branch)"
69-git pull origin "${b:=$1}"
70+[[ "$#" == 0 ]] && local b="$(current_branch)"
71+git pull origin "${b:=$1}" "${*[2,-1]}"
72 }
73 compdef _git ggl=git-checkout
74+alias ggpull='ggl'
75+compdef _git ggpull=git-checkout
76 ggp() {
77-[[ "$#" != 1 ]] && b="$(current_branch)"
78+if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
79+git push origin "${*}"
80+else
81+[[ "$#" == 0 ]] && local b="$(current_branch)"
82 git push origin "${b:=$1}"
83+fi
84 }
85 compdef _git ggp=git-checkout
86+alias ggpush='ggp'
87+compdef _git ggpush=git-checkout
88 ggpnp() {
89-ggl "$1" && ggp "$1"
90+if [[ "$#" == 0 ]]; then
91+ggl && ggp
92+else
93+ggl "${*}" && ggp "${*}"
94+fi
95 }
96 compdef _git ggpnp=git-checkout
97 alias ggsup='git branch --set-upstream-to=origin/$(current_branch)'
98 ggu() {
99-[[ "$#" != 1 ]] && b="$(current_branch)"
100+[[ "$#" != 1 ]] && local b="$(current_branch)"
101 git pull --rebase origin "${b:=$1}"
102 }
103 compdef _git ggu=git-checkout
104+alias ggpur='ggu'