From 7f5f8c36f5935b8c3e8a53420d55d195e0ab0774 Mon Sep 17 00:00:00 2001 From: Anton Eicher Date: Wed, 19 Dec 2012 07:22:03 -0800 Subject: [PATCH 01/18] Added check for .git directory in current, before wasting time querying git. This saves seconds on my pc. --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 9f7819df3..6e6ba0560 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -108,12 +108,14 @@ alias gsd='git svn dcommit' # Usage example: git pull origin $(current_branch) # function current_branch() { + if [ ! -d .git ]; then return; fi ref=$(git symbolic-ref HEAD 2> /dev/null) || \ ref=$(git rev-parse --short HEAD 2> /dev/null) || return echo ${ref#refs/heads/} } function current_repository() { + if [ ! -d .git ]; then return; fi ref=$(git symbolic-ref HEAD 2> /dev/null) || \ ref=$(git rev-parse --short HEAD 2> /dev/null) || return echo $(git remote -v | cut -d':' -f 2) From e3d8d7bebe9b73186d02a7b10624e7ade2b41060 Mon Sep 17 00:00:00 2001 From: Maxime Fabre Date: Fri, 12 Jul 2013 15:26:04 +0200 Subject: [PATCH 02/18] Add submodule helpers to Git plugin From #1116 Modified: compdef needs _git entry point Modifier: ncanceill Original commit: Author : Maxime Fabre diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6e6ba05..53046de 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -161,4 +161,10 @@ alias gunignore='git update-index --no-assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' - +# Submodules +alias gf='git fetch' +compdef _git gf=git-fetch +alias gsi='git submodule init' +compdef gsi=git-submodule +alias gsu='git submodule update' +compdef gsu=git-submodule --- plugins/git/git.plugin.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 6e6ba0560..925782269 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -161,4 +161,10 @@ alias gunignore='git update-index --no-assume-unchanged' alias gignored='git ls-files -v | grep "^[[:lower:]]"' - +# Submodules +alias gf='git fetch' +compdef _git gf=git-fetch +alias gsi='git submodule init' +compdef _git gsi=git-submodule +alias gsu='git submodule update' +compdef _git gsu=git-submodule From 588943ea5712b38cf10df768860179249a852215 Mon Sep 17 00:00:00 2001 From: Kirill Panshin Date: Tue, 17 Jul 2012 11:58:32 +0400 Subject: [PATCH 03/18] Additional commands to git plugin Original author : Kirill Panshin Merged & cleaned by: ncanceill --- plugins/git/git.plugin.zsh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 925782269..2f9085d7d 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -13,7 +13,6 @@ alias gup='git pull --rebase' compdef _git gup=git-fetch alias gp='git push' compdef _git gp=git-push -alias gd='git diff' gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff alias gc='git commit -v' @@ -21,7 +20,7 @@ compdef _git gc=git-commit alias gc!='git commit -v --amend' compdef _git gc!=git-commit alias gca='git commit -v -a' -compdef _git gc=git-commit +compdef _git gca=git-commit alias gca!='git commit -v -a --amend' compdef _git gca!=git-commit alias gcmsg='git commit -m' @@ -56,9 +55,11 @@ compdef gcount=git alias gcl='git config --list' alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick -alias glg='git log --stat --max-count=10' +alias glg='git log --stat --color' compdef _git glg=git-log -alias glgg='git log --graph --max-count=10' +alias glgp='git log --stat --color -p' +compdef _git glgp=git-log +alias glgg='git log --graph --color' compdef _git glgg=git-log alias glgga='git log --graph --decorate --all' compdef _git glgga=git-log From 00072a8831dc2519acfe802ba62d0ad9c981f596 Mon Sep 17 00:00:00 2001 From: Marten Lienen Date: Wed, 19 Feb 2014 16:58:00 +0100 Subject: [PATCH 04/18] Add aliases for `git rebase` and `git rebase skip` Original author : Marten Lienen Merged & cleaned by: ncanceill --- plugins/git/git.plugin.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 2f9085d7d..f2dfd6256 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -40,10 +40,14 @@ alias grset='git remote set-url' compdef _git grset=git-remote alias grup='git remote update' compdef _git grset=git-remote +alias grb='git rebase' +compdef _git grb=git-rebase alias grbi='git rebase -i' compdef _git grbi=git-rebase alias grbc='git rebase --continue' compdef _git grbc=git-rebase +alias grbs='git rebase --skip' +compdef _git grbs=git-rebase alias grba='git rebase --abort' compdef _git grba=git-rebase alias gb='git branch' @@ -161,7 +165,6 @@ alias gunignore='git update-index --no-assume-unchanged' # list temporarily ignored files alias gignored='git ls-files -v | grep "^[[:lower:]]"' - # Submodules alias gf='git fetch' compdef _git gf=git-fetch From a6c6bce3bd4bac27e939e4d65485b77cec635396 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Fri, 11 Apr 2014 10:59:13 +0200 Subject: [PATCH 05/18] fix gwip alias for some BSD flavors, fixes #2692 --- plugins/git/git.plugin.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index f2dfd6256..325b65ee4 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -155,8 +155,12 @@ function work_in_progress() { echo "WIP!!" fi } -# these alias commit and uncomit wip branches -alias gwip='git add -A; git ls-files --deleted -z | xargs -r0 git rm; git commit -m "--wip--"' + +# these aliases commit and uncommit wip branches +# first though, check xargs flavor for -r flag +echo | xargs -r &>/dev/null && XARGS_OPTS="-r" +alias gwip="git add -A; git ls-files --deleted -z | xargs ${XARGS_OPTS} -0 git rm; git commit -m \"--wip--\"" +unset XARGS_OPTS alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' # these alias ignore changes to file From 9224918c3c215a725fdb92b231eeccc54a3d235f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Cauwelier?= Date: Sat, 12 Jan 2013 12:17:45 +0100 Subject: [PATCH 06/18] plugins/git: missing compdefs, fix bad copy-paste MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original author : Hervé Cauwelier Merged & cleaned by: ncanceill --- plugins/git/git.plugin.zsh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 325b65ee4..e72623875 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -28,6 +28,7 @@ compdef _git gcmsg=git-commit alias gco='git checkout' compdef _git gco=git-checkout alias gcm='git checkout master' +compdef _git gcm=git-checkout alias gr='git remote' compdef _git gr=git-remote alias grv='git remote -v' @@ -57,6 +58,7 @@ compdef _git gba=git-branch alias gcount='git shortlog -sn' compdef gcount=git alias gcl='git config --list' +compdef _git gcl=git-config alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick alias glg='git log --stat --color' @@ -78,14 +80,14 @@ compdef _git ga=git-add alias gm='git merge' compdef _git gm=git-merge alias grh='git reset HEAD' +compdef _git grh=git-reset alias grhh='git reset HEAD --hard' +compdef _git grhh=git-reset alias gclean='git reset --hard && git clean -dfx' alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' - -#remove the gf alias -#alias gf='git ls-files | grep' - +compdef _git gwc=git-whatchanged alias gpoat='git push origin --all && git push origin --tags' +compdef _git gpoat=git-push alias gmt='git mergetool --no-prompt' compdef _git gm=git-mergetool From a55412801cae6b89da93e955753302764a7d7dce Mon Sep 17 00:00:00 2001 From: Mitchel Humpherys Date: Tue, 7 Jan 2014 12:47:58 -0800 Subject: [PATCH 07/18] Fix gmt compdef Fix typo: gm -> gmt --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index e72623875..b24284e00 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -89,7 +89,7 @@ compdef _git gwc=git-whatchanged alias gpoat='git push origin --all && git push origin --tags' compdef _git gpoat=git-push alias gmt='git mergetool --no-prompt' -compdef _git gm=git-mergetool +compdef _git gmt=git-mergetool alias gg='git gui citool' alias gga='git gui citool --amend' From 54abcf6c849374db388eead538c37d4a7ec0e800 Mon Sep 17 00:00:00 2001 From: thuai Date: Sat, 17 May 2014 14:11:18 +0800 Subject: [PATCH 08/18] add alias for 'git stash list' --- plugins/git/git.plugin.zsh | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index b24284e00..d3cab7b8e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -99,6 +99,7 @@ alias gsts='git stash show --text' alias gsta='git stash' alias gstp='git stash pop' alias gstd='git stash drop' +alias gstl='git stash list' # Will cd into the top of the current repository # or submodule. From c0868ea1c00f321cff220e125e473476263c4515 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Wed, 21 May 2014 12:25:40 +0200 Subject: [PATCH 09/18] re-organized plugin (no real change) --- plugins/git/git.plugin.zsh | 165 ++++++++++++++++++++----------------- 1 file changed, 90 insertions(+), 75 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index d3cab7b8e..324b35130 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -1,20 +1,70 @@ +# +# Compatibility +# + +# Check xargs flavor for -r flag +echo | xargs -r &>/dev/null && XARGS_OPTS="-r" + +# +# Functions +# + +# The current branch name +# Usage example: git pull origin $(current_branch) +function current_branch() { + if [ ! -d .git ]; then return; fi + ref=$(git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(git rev-parse --short HEAD 2> /dev/null) || return + echo ${ref#refs/heads/} +} +# The list of remotes +function current_repository() { + if [ ! -d .git ]; then return; fi + ref=$(git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(git rev-parse --short HEAD 2> /dev/null) || return + echo $(git remote -v | cut -d':' -f 2) +} +# Pretty log messages +function _git_log_prettily(){ + if ! [ -z $1 ]; then + git log --pretty=$1 + fi +} +# This function return a warning if the current branch is a wip +function work_in_progress() { + if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then + echo "WIP!!" + fi +} + +# # Aliases +# alias g='git' compdef g=git +# Status alias gst='git status' compdef _git gst=git-status +alias gss='git status -s' +compdef _git gss=git-status +# Diff alias gd='git diff' compdef _git gd=git-diff alias gdc='git diff --cached' compdef _git gdc=git-diff +gdv() { git diff -w "$@" | view - } +compdef _git gdv=git-diff +# Pull alias gl='git pull' compdef _git gl=git-pull alias gup='git pull --rebase' compdef _git gup=git-fetch +# Push alias gp='git push' compdef _git gp=git-push -gdv() { git diff -w "$@" | view - } -compdef _git gdv=git-diff +alias gpoat='git push origin --all && git push origin --tags' +compdef _git gpoat=git-push +# Commit alias gc='git commit -v' compdef _git gc=git-commit alias gc!='git commit -v --amend' @@ -25,10 +75,12 @@ alias gca!='git commit -v -a --amend' compdef _git gca!=git-commit alias gcmsg='git commit -m' compdef _git gcmsg=git-commit +# Checkout alias gco='git checkout' compdef _git gco=git-checkout alias gcm='git checkout master' compdef _git gcm=git-checkout +# Remote alias gr='git remote' compdef _git gr=git-remote alias grv='git remote -v' @@ -41,6 +93,7 @@ alias grset='git remote set-url' compdef _git grset=git-remote alias grup='git remote update' compdef _git grset=git-remote +# Rebase alias grb='git rebase' compdef _git grb=git-rebase alias grbi='git rebase -i' @@ -51,16 +104,34 @@ alias grbs='git rebase --skip' compdef _git grbs=git-rebase alias grba='git rebase --abort' compdef _git grba=git-rebase +# Cherry-pick +alias gcp='git cherry-pick' +compdef _git gcp=git-cherry-pick +# Branch alias gb='git branch' compdef _git gb=git-branch alias gba='git branch -a' compdef _git gba=git-branch -alias gcount='git shortlog -sn' -compdef gcount=git +# Config alias gcl='git config --list' compdef _git gcl=git-config -alias gcp='git cherry-pick' -compdef _git gcp=git-cherry-pick +# Add +alias ga='git add' +compdef _git ga=git-add +# Merge +alias gm='git merge' +compdef _git gm=git-merge +alias gmt='git mergetool --no-prompt' +compdef _git gmt=git-mergetool +# Reset +alias grh='git reset HEAD' +compdef _git grh=git-reset +alias grhh='git reset HEAD --hard' +compdef _git grhh=git-reset +alias gclean='git reset --hard && git clean -dfx' +# Log +alias gcount='git shortlog -sn' +compdef gcount=git alias glg='git log --stat --color' compdef _git glg=git-log alias glgp='git log --stat --color -p' @@ -73,105 +144,46 @@ alias glo='git log --oneline --decorate --color' compdef _git glo=git-log alias glog='git log --oneline --decorate --color --graph' compdef _git glog=git-log -alias gss='git status -s' -compdef _git gss=git-status -alias ga='git add' -compdef _git ga=git-add -alias gm='git merge' -compdef _git gm=git-merge -alias grh='git reset HEAD' -compdef _git grh=git-reset -alias grhh='git reset HEAD --hard' -compdef _git grhh=git-reset -alias gclean='git reset --hard && git clean -dfx' alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' compdef _git gwc=git-whatchanged -alias gpoat='git push origin --all && git push origin --tags' -compdef _git gpoat=git-push -alias gmt='git mergetool --no-prompt' -compdef _git gmt=git-mergetool - +alias glp="_git_log_prettily" +compdef _git glp=git-log +# GUI alias gg='git gui citool' alias gga='git gui citool --amend' alias gk='gitk --all --branches' - +# Stash alias gsts='git stash show --text' alias gsta='git stash' alias gstp='git stash pop' alias gstd='git stash drop' alias gstl='git stash list' - -# Will cd into the top of the current repository -# or submodule. +# cd into the top of the current repository or submodule alias grt='cd $(git rev-parse --show-toplevel || echo ".")' - # Git and svn mix alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk' compdef git-svn-dcommit-push=git - alias gsr='git svn rebase' alias gsd='git svn dcommit' -# -# Will return the current branch name -# Usage example: git pull origin $(current_branch) -# -function current_branch() { - if [ ! -d .git ]; then return; fi - ref=$(git symbolic-ref HEAD 2> /dev/null) || \ - ref=$(git rev-parse --short HEAD 2> /dev/null) || return - echo ${ref#refs/heads/} -} - -function current_repository() { - if [ ! -d .git ]; then return; fi - ref=$(git symbolic-ref HEAD 2> /dev/null) || \ - ref=$(git rev-parse --short HEAD 2> /dev/null) || return - echo $(git remote -v | cut -d':' -f 2) -} - -# these aliases take advantage of the previous function +# Current branch alias ggpull='git pull origin $(current_branch)' compdef ggpull=git alias ggpur='git pull --rebase origin $(current_branch)' compdef ggpur=git alias ggpush='git push origin $(current_branch)' compdef ggpush=git -alias ggpnp='git pull origin $(current_branch) && git push origin $(current_branch)' +alias ggpnp='git pull origin $(current_branch) &&git push origin $(current_branch)' compdef ggpnp=git - -# Pretty log messages -function _git_log_prettily(){ - if ! [ -z $1 ]; then - git log --pretty=$1 - fi -} -alias glp="_git_log_prettily" -compdef _git glp=git-log - # Work In Progress (wip) -# These features allow to pause a branch development and switch to another one (wip) +# These features allow to pause a branch development and switch to another one # When you want to go back to work, just unwip it -# -# This function return a warning if the current branch is a wip -function work_in_progress() { - if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then - echo "WIP!!" - fi -} - -# these aliases commit and uncommit wip branches -# first though, check xargs flavor for -r flag -echo | xargs -r &>/dev/null && XARGS_OPTS="-r" alias gwip="git add -A; git ls-files --deleted -z | xargs ${XARGS_OPTS} -0 git rm; git commit -m \"--wip--\"" -unset XARGS_OPTS alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' - -# these alias ignore changes to file +# Ignore changes to file alias gignore='git update-index --assume-unchanged' alias gunignore='git update-index --no-assume-unchanged' -# list temporarily ignored files +# List temporarily ignored files alias gignored='git ls-files -v | grep "^[[:lower:]]"' - # Submodules alias gf='git fetch' compdef _git gf=git-fetch @@ -179,3 +191,6 @@ alias gsi='git submodule init' compdef _git gsi=git-submodule alias gsu='git submodule update' compdef _git gsu=git-submodule + +# Compatibility +unset XARGS_OPTS From be8e85b71c4e614501edeb59358ef805674f98f7 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Wed, 21 May 2014 13:12:49 +0200 Subject: [PATCH 10/18] update aliases to default to current branch, fixes #1601 --- plugins/git/git.plugin.zsh | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 324b35130..f1157c5a9 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -166,14 +166,25 @@ compdef git-svn-dcommit-push=git alias gsr='git svn rebase' alias gsd='git svn dcommit' # Current branch -alias ggpull='git pull origin $(current_branch)' -compdef ggpull=git -alias ggpur='git pull --rebase origin $(current_branch)' -compdef ggpur=git -alias ggpush='git push origin $(current_branch)' -compdef ggpush=git -alias ggpnp='git pull origin $(current_branch) &&git push origin $(current_branch)' -compdef ggpnp=git +ggl() { + [[ "$#" != 1 ]] && b="$(current_branch)" + git pull origin "${b:=$1}" +} +compdef _git ggl=git-checkout +ggu() { + [[ "$#" != 1 ]] && b="$(current_branch)" + git pull --rebase origin "${b:=$1}" +} +compdef _git ggu=git-checkout +ggp() { + [[ "$#" != 1 ]] && b="$(current_branch)" + git push origin "${b:=$1}" +} +compdef _git ggp=git-checkout +ggpnp() { + ggl "$1" && ggp "$1" +} +compdef _git ggpnp=git-checkout # Work In Progress (wip) # These features allow to pause a branch development and switch to another one # When you want to go back to work, just unwip it From f93ee152a4a7ed098fc7292d0f2387599d7b43d6 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Wed, 21 May 2014 13:44:52 +0200 Subject: [PATCH 11/18] improve readme to abide by #2640 --- plugins/git/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/git/README.md b/plugins/git/README.md index 8462dda1c..5150656df 100644 --- a/plugins/git/README.md +++ b/plugins/git/README.md @@ -1,4 +1,10 @@ ## git -**Maintainer:** [Stibbons](https://github.com/Stibbons) -This plugin adds several git aliases and increase the completion function provided by zsh +**Maintainers:** [@Stibbons](https://github.com/Stibbons), [@ncanceill](https://github.com/ncanceill) + +This plugin adds many aliases and improves the default completion function. + +### Usage + +See the [wiki](https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git) for a list of aliases and functions provided by the plugin. + From 378a99f25bdd59baa8db76dc101456debcce1655 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Wed, 21 May 2014 17:14:15 +0200 Subject: [PATCH 12/18] change alias gwc to gwch, fixes #2463 --- plugins/git/git.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index f1157c5a9..c5efb4087 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -144,8 +144,8 @@ alias glo='git log --oneline --decorate --color' compdef _git glo=git-log alias glog='git log --oneline --decorate --color --graph' compdef _git glog=git-log -alias gwc='git whatchanged -p --abbrev-commit --pretty=medium' -compdef _git gwc=git-whatchanged +alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' +compdef _git gwch=git-whatchanged alias glp="_git_log_prettily" compdef _git glp=git-log # GUI From 41b181ff37509f98593b11a74b8deabdc187e3bd Mon Sep 17 00:00:00 2001 From: ncanceill Date: Sat, 24 May 2014 19:24:19 +0200 Subject: [PATCH 13/18] add aliases from #2494 --- plugins/git/git.plugin.zsh | 55 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index c5efb4087..3821a2e4b 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -62,6 +62,10 @@ compdef _git gup=git-fetch # Push alias gp='git push' compdef _git gp=git-push +alias gpf='git push --force' +compdef _git gpf=git-push +alias gpd='git push --dry-run' +compdef _git gpd=git-push alias gpoat='git push origin --all && git push origin --tags' compdef _git gpoat=git-push # Commit @@ -96,14 +100,36 @@ compdef _git grset=git-remote # Rebase alias grb='git rebase' compdef _git grb=git-rebase -alias grbi='git rebase -i' -compdef _git grbi=git-rebase alias grbc='git rebase --continue' compdef _git grbc=git-rebase alias grbs='git rebase --skip' compdef _git grbs=git-rebase alias grba='git rebase --abort' compdef _git grba=git-rebase +alias grbm='git rebase master' +compdef _git grbm=git-rebase +alias grbi='git rebase -i' +compdef _git grbi=git-rebase +alias gr1='git rebase -i HEAD~' +compdef _git gr1=git-rebase +alias gr2='git rebase -i HEAD~2' +compdef _git gr2=git-rebase +alias gr3='git rebase -i HEAD~3' +compdef _git gr3=git-rebase +alias gr4='git rebase -i HEAD~4' +compdef _git gr4=git-rebase +alias gr5='git rebase -i HEAD~5' +compdef _git gr5=git-rebase +alias gr6='git rebase -i HEAD~6' +compdef _git gr6=git-rebase +alias gr7='git rebase -i HEAD~7' +compdef _git gr7=git-rebase +alias gr8='git rebase -i HEAD~8' +compdef _git gr8=git-rebase +alias gr9='git rebase -i HEAD~9' +compdef _git gr9=git-rebase +alias gr10='git rebase -i HEAD~10' +compdef _git gr10=git-rebase # Cherry-pick alias gcp='git cherry-pick' compdef _git gcp=git-cherry-pick @@ -121,8 +147,12 @@ compdef _git ga=git-add # Merge alias gm='git merge' compdef _git gm=git-merge +alias gmum='git merge upstream/master' +compdef _git gmum=git-merge alias gmt='git mergetool --no-prompt' compdef _git gmt=git-mergetool +alias gmtvim='git mergetool --no-prompt --tool=vimdiff' +compdef _git gmtvim=git-mergetool # Reset alias grh='git reset HEAD' compdef _git grh=git-reset @@ -144,6 +174,8 @@ alias glo='git log --oneline --decorate --color' compdef _git glo=git-log alias glog='git log --oneline --decorate --color --graph' compdef _git glog=git-log +alias glgm='git log --graph --max-count=10' +compdef _git glgm=git-log alias gwch='git whatchanged -p --abbrev-commit --pretty=medium' compdef _git gwch=git-whatchanged alias glp="_git_log_prettily" @@ -154,10 +186,29 @@ alias gga='git gui citool --amend' alias gk='gitk --all --branches' # Stash alias gsts='git stash show --text' +compdef _git gsts='git-stash' alias gsta='git stash' +compdef _git gsta='git-stash' alias gstp='git stash pop' +compdef _git gstp='git-stash' alias gstd='git stash drop' +compdef _git gstd='git-stash' alias gstl='git stash list' +compdef _git gstl='git-stash' +alias gstaa='git stash apply' +compdef _git gstaa='git-stash' +# Gitk +alias gk='\gitk --all --branches' +compdef _git gk='gitk' +# show complete history, with dangling commits +# Note: if the commit has been cleaned by 'git gc', the dangling +# commits older than 2 weeks may have been deleted +alias gke='\gitk --all $(git log -g --pretty=format:%h)' +compdef _git gke='gitk' +# Remove all .orig, .BASE.*, .REMOTE.*, .LOCAL.*, *.BACKUP files +alias gclean="find . -name '*.orig' -or -name '*.REMOTE.*' -or \ +-name '*.LOCAL.*' -or -name '*.BACKUP.*' -or -name '*.BASE.*' | \ +xargs $XARGS_OPTS rm -v" # cd into the top of the current repository or submodule alias grt='cd $(git rev-parse --show-toplevel || echo ".")' # Git and svn mix From 10e88bd791988ecec9c8c50cd1c85a37131de0e1 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Thu, 29 May 2014 10:51:49 +0200 Subject: [PATCH 14/18] add gbnm alias for non-merged branches inspired from #1982 --- plugins/git/git.plugin.zsh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 3821a2e4b..3b2d0aec9 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -138,6 +138,8 @@ alias gb='git branch' compdef _git gb=git-branch alias gba='git branch -a' compdef _git gba=git-branch +alias gbnm='git branch --no-merged' +compdef _git gbnm=git-branch # Config alias gcl='git config --list' compdef _git gcl=git-config From b167029a286087e1eb28aa041ce564f42703ea73 Mon Sep 17 00:00:00 2001 From: Yachi Lo Date: Tue, 24 Sep 2013 15:25:03 +0800 Subject: [PATCH 15/18] bring back `git ls-files|grep $1` as a function, and add completion --- plugins/git/git.plugin.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 3b2d0aec9..aca33f679 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -248,6 +248,9 @@ alias gignore='git update-index --assume-unchanged' alias gunignore='git update-index --no-assume-unchanged' # List temporarily ignored files alias gignored='git ls-files -v | grep "^[[:lower:]]"' +# Grep list of files in the index +function gfg() { git ls-files | grep $@ } +compdef gfg=grep # Submodules alias gf='git fetch' compdef _git gf=git-fetch From e2595c5ff5ec04dde4be01b610fbdce93664caae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20S=C3=A1nchez?= Date: Wed, 11 Dec 2013 13:24:19 +0100 Subject: [PATCH 16/18] Avoid showing 'git rm' usage when using gwip alias --- plugins/git/git.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index aca33f679..178d079d8 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -241,7 +241,7 @@ compdef _git ggpnp=git-checkout # Work In Progress (wip) # These features allow to pause a branch development and switch to another one # When you want to go back to work, just unwip it -alias gwip="git add -A; git ls-files --deleted -z | xargs ${XARGS_OPTS} -0 git rm; git commit -m \"--wip--\"" +alias gwip="git add -A; git ls-files --deleted -z | xargs ${XARGS_OPTS} -0 git rm 2>/dev/null; git commit -m \"--wip--\"" alias gunwip='git log -n 1 | grep -q -c "\-\-wip\-\-" && git reset HEAD~1' # Ignore changes to file alias gignore='git update-index --assume-unchanged' From 92ee30e7be6b02dd7da6670d12832d657eef23cc Mon Sep 17 00:00:00 2001 From: ncanceill Date: Tue, 10 Jun 2014 10:08:44 +0200 Subject: [PATCH 17/18] Added aliases suggested by @santacruz123 fixes #2433 --- plugins/git/git.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 178d079d8..1eee3451e 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -54,6 +54,8 @@ alias gdc='git diff --cached' compdef _git gdc=git-diff gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff +alias gbl='git blame -b -w' +compdef _git gbl=git-blame # Pull alias gl='git pull' compdef _git gl=git-pull @@ -160,6 +162,8 @@ alias grh='git reset HEAD' compdef _git grh=git-reset alias grhh='git reset HEAD --hard' compdef _git grhh=git-reset +alias gru='git reset --' +compdef _git gru=git-reset alias gclean='git reset --hard && git clean -dfx' # Log alias gcount='git shortlog -sn' From 81266ba5ad8133f1d0a1bbf2805d31234a6a62d9 Mon Sep 17 00:00:00 2001 From: ncanceill Date: Tue, 10 Jun 2014 10:11:57 +0200 Subject: [PATCH 18/18] Added aliases suggested by @lucasuyezu fixes #2493 --- plugins/git/git.plugin.zsh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh index 1eee3451e..b1a6e1100 100644 --- a/plugins/git/git.plugin.zsh +++ b/plugins/git/git.plugin.zsh @@ -47,6 +47,8 @@ alias gst='git status' compdef _git gst=git-status alias gss='git status -s' compdef _git gss=git-status +alias gsb='git status -sb' +compdef _git gsb=git-status # Diff alias gd='git diff' compdef _git gd=git-diff @@ -54,6 +56,8 @@ alias gdc='git diff --cached' compdef _git gdc=git-diff gdv() { git diff -w "$@" | view - } compdef _git gdv=git-diff +alias gdw='git diff --word-diff' +compdef _git gdw=git-diff alias gbl='git blame -b -w' compdef _git gbl=git-blame # Pull