2012-01-31 23:37:51 -05:00
|
|
|
#
|
|
|
|
# Defines Git aliases.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
|
|
|
#
|
|
|
|
|
2012-10-01 21:20:59 -04:00
|
|
|
#
|
|
|
|
# Settings
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2012-10-01 22:26:24 -04:00
|
|
|
# Log
|
|
|
|
zstyle -s ':prezto:module:git:log:medium' format '_git_log_medium_format' \
|
|
|
|
|| _git_log_medium_format='%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B'
|
|
|
|
zstyle -s ':prezto:module:git:log:oneline' format '_git_log_oneline_format' \
|
|
|
|
|| _git_log_oneline_format='%C(green)%h%C(reset) %s%C(red)%d%C(reset)%n'
|
|
|
|
zstyle -s ':prezto:module:git:log:brief' format '_git_log_brief_format' \
|
|
|
|
|| _git_log_brief_format='%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n'
|
|
|
|
|
2012-10-01 21:20:59 -04:00
|
|
|
# Status
|
|
|
|
zstyle -s ':prezto:module:git:status:ignore' submodules '_git_status_ignore_submodules' \
|
|
|
|
|| _git_status_ignore_submodules='none'
|
|
|
|
|
|
|
|
#
|
|
|
|
# Aliases
|
|
|
|
#
|
|
|
|
|
2011-09-05 00:37:36 -04:00
|
|
|
# Git
|
|
|
|
alias g='git'
|
|
|
|
|
2012-01-20 22:32:17 -05:00
|
|
|
# Branch (b)
|
2011-09-05 00:37:36 -04:00
|
|
|
alias gb='git branch'
|
|
|
|
alias gbc='git checkout -b'
|
|
|
|
alias gbl='git branch -v'
|
|
|
|
alias gbL='git branch -av'
|
|
|
|
alias gbx='git branch -d'
|
|
|
|
alias gbX='git branch -D'
|
|
|
|
alias gbm='git branch -m'
|
|
|
|
alias gbM='git branch -M'
|
2012-04-15 10:38:42 -04:00
|
|
|
alias gbs='git show-branch'
|
|
|
|
alias gbS='git show-branch -a'
|
2011-09-05 00:37:36 -04:00
|
|
|
|
|
|
|
# Commit (c)
|
|
|
|
alias gc='git commit'
|
|
|
|
alias gca='git commit --all'
|
|
|
|
alias gcm='git commit --message'
|
|
|
|
alias gco='git checkout'
|
|
|
|
alias gcO='git checkout HEAD --'
|
|
|
|
alias gcf='git commit --amend --reuse-message HEAD'
|
2012-12-20 19:49:07 -05:00
|
|
|
alias gcF='git commit --amend'
|
2011-09-05 00:37:36 -04:00
|
|
|
alias gcp='git cherry-pick --ff'
|
|
|
|
alias gcP='git cherry-pick --no-commit'
|
|
|
|
alias gcr='git revert'
|
|
|
|
alias gcR='git reset "HEAD^"'
|
|
|
|
alias gcs='git show'
|
2012-05-21 17:25:07 -04:00
|
|
|
alias gcl='git-commit-lost'
|
2011-09-05 00:37:36 -04:00
|
|
|
|
2012-01-20 22:32:17 -05:00
|
|
|
# Data (d)
|
2011-09-05 00:37:36 -04:00
|
|
|
alias gd='git ls-files'
|
|
|
|
alias gdc='git ls-files --cached'
|
|
|
|
alias gdx='git ls-files --deleted'
|
|
|
|
alias gdm='git ls-files --modified'
|
2012-01-20 13:35:31 -05:00
|
|
|
alias gdu='git ls-files --other --exclude-standard'
|
2011-09-05 00:37:36 -04:00
|
|
|
alias gdk='git ls-files --killed'
|
|
|
|
alias gdi='git status --porcelain --short --ignored | sed -n "s/^!! //p"'
|
|
|
|
|
2012-01-20 22:32:17 -05:00
|
|
|
# Fetch (f)
|
|
|
|
alias gf='git fetch'
|
|
|
|
alias gfc='git clone'
|
|
|
|
alias gfm='git pull'
|
|
|
|
alias gfr='git pull --rebase'
|
|
|
|
|
2012-09-24 23:49:58 -04:00
|
|
|
# Grep (g)
|
|
|
|
alias gg='git grep'
|
|
|
|
alias ggi='git grep --ignore-case'
|
|
|
|
alias ggl='git grep --files-with-matches'
|
|
|
|
alias ggL='git grep --files-without-matches'
|
|
|
|
alias ggv='git grep --invert-match'
|
|
|
|
alias ggw='git grep --word-regexp'
|
|
|
|
|
2012-01-20 22:32:17 -05:00
|
|
|
# Index (i)
|
|
|
|
alias gia='git add'
|
|
|
|
alias giA='git add --patch'
|
|
|
|
alias giu='git add --update'
|
|
|
|
alias gid='git diff --no-ext-diff --cached'
|
2012-03-30 12:00:14 -04:00
|
|
|
alias giD='git diff --no-ext-diff --cached --word-diff'
|
2012-04-08 14:56:14 -04:00
|
|
|
alias gir='git reset'
|
2012-03-30 12:04:59 -04:00
|
|
|
alias giR='git reset --keep'
|
2012-01-20 22:32:17 -05:00
|
|
|
alias gix='git rm -r --cached'
|
|
|
|
alias giX='git rm -rf --cached'
|
|
|
|
|
2012-10-01 22:14:33 -04:00
|
|
|
# Conflict (C)
|
|
|
|
alias gCl='git status | sed -n "s/^.*both [a-z]*ed: *//p"'
|
|
|
|
alias gCa='git add $(gCl)'
|
|
|
|
alias gCe='git mergetool $(gCl)'
|
|
|
|
alias gCo='git checkout --ours --'
|
|
|
|
alias gCO='gCo $(gCl)'
|
|
|
|
alias gCt='git checkout --theirs --'
|
|
|
|
alias gCT='gCt $(gCl)'
|
2012-01-20 22:32:17 -05:00
|
|
|
|
|
|
|
# Log (l)
|
2012-10-01 22:26:24 -04:00
|
|
|
alias gl='git log --topo-order --pretty=format:${_git_log_medium_format}'
|
|
|
|
alias gls='git log --topo-order --stat --pretty=format:${_git_log_medium_format}'
|
|
|
|
alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:${_git_log_medium_format}'
|
|
|
|
alias glo='git log --topo-order --pretty=format:${_git_log_oneline_format}'
|
|
|
|
alias glg='git log --topo-order --all --graph --pretty=format:${_git_log_oneline_format}'
|
|
|
|
alias glb='git log --topo-order --pretty=format:${_git_log_brief_format}'
|
2012-01-20 22:32:17 -05:00
|
|
|
alias glc='git shortlog --summary --numbered'
|
|
|
|
|
2011-09-05 00:37:36 -04:00
|
|
|
# Merge (m)
|
|
|
|
alias gm='git merge'
|
|
|
|
alias gmC='git merge --no-commit'
|
|
|
|
alias gmF='git merge --no-ff'
|
|
|
|
alias gma='git merge --abort'
|
|
|
|
alias gmt='git mergetool'
|
|
|
|
|
2012-01-20 22:32:17 -05:00
|
|
|
# Push (p)
|
2011-09-05 00:37:36 -04:00
|
|
|
alias gp='git push'
|
|
|
|
alias gpf='git push --force'
|
|
|
|
alias gpa='git push --all'
|
|
|
|
alias gpA='git push --all && git push --tags'
|
|
|
|
alias gpt='git push --tags'
|
2012-09-30 15:32:43 -04:00
|
|
|
alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"'
|
|
|
|
alias gpp='git pull origin "$(git-branch-current 2> /dev/null)" && git push origin "$(git-branch-current 2> /dev/null)"'
|
2011-09-05 00:37:36 -04:00
|
|
|
|
|
|
|
# Rebase (r)
|
|
|
|
alias gr='git rebase'
|
|
|
|
alias gra='git rebase --abort'
|
|
|
|
alias grc='git rebase --continue'
|
|
|
|
alias gri='git rebase --interactive'
|
|
|
|
alias grs='git rebase --skip'
|
|
|
|
|
2012-01-20 22:32:17 -05:00
|
|
|
# Remote (R)
|
|
|
|
alias gR='git remote'
|
|
|
|
alias gRl='git remote --verbose'
|
|
|
|
alias gRa='git remote add'
|
|
|
|
alias gRx='git remote rm'
|
|
|
|
alias gRm='git remote rename'
|
|
|
|
alias gRu='git remote update'
|
|
|
|
alias gRc='git remote prune'
|
|
|
|
alias gRs='git remote show'
|
2012-09-24 18:10:01 -04:00
|
|
|
alias gRb='git-hub-browse'
|
2012-01-20 22:32:17 -05:00
|
|
|
|
|
|
|
# Stash (s)
|
|
|
|
alias gs='git stash'
|
|
|
|
alias gsa='git stash apply'
|
|
|
|
alias gsx='git stash drop'
|
2012-09-30 20:45:23 -04:00
|
|
|
alias gsX='git-stash-clear-interactive'
|
2012-05-21 17:22:49 -04:00
|
|
|
alias gsd='git-stash-dropped'
|
2012-01-20 22:32:17 -05:00
|
|
|
alias gsl='git stash list'
|
|
|
|
alias gsL='git stash show --patch --stat'
|
|
|
|
alias gsp='git stash pop'
|
2012-05-21 17:22:49 -04:00
|
|
|
alias gsr='git-stash-recover'
|
2012-02-10 16:37:20 -05:00
|
|
|
alias gss='git stash save --include-untracked'
|
2012-01-20 22:32:17 -05:00
|
|
|
alias gsS='git stash save --patch --no-keep-index'
|
2012-09-24 23:49:23 -04:00
|
|
|
alias gsw='git stash save --include-untracked --keep-index'
|
2012-01-20 22:32:17 -05:00
|
|
|
|
|
|
|
# Submodule (S)
|
|
|
|
alias gS='git submodule'
|
|
|
|
alias gSa='git submodule add'
|
|
|
|
alias gSf='git submodule foreach'
|
|
|
|
alias gSi='git submodule init'
|
2012-09-30 20:46:21 -04:00
|
|
|
alias gSI='git submodule update --init --recursive'
|
2012-01-20 22:32:17 -05:00
|
|
|
alias gSl='git submodule status'
|
2012-09-24 18:45:36 -04:00
|
|
|
alias gSm='git-submodule-move'
|
2012-01-20 22:32:17 -05:00
|
|
|
alias gSs='git submodule sync'
|
2012-09-30 20:46:21 -04:00
|
|
|
alias gSu='git submodule foreach git pull origin master'
|
2012-09-24 18:45:36 -04:00
|
|
|
alias gSx='git-submodule-remove'
|
2011-09-05 00:37:36 -04:00
|
|
|
|
2012-01-20 22:32:17 -05:00
|
|
|
# Working Copy (w)
|
2012-10-01 21:20:59 -04:00
|
|
|
alias gws='git status --ignore-submodules=${_git_status_ignore_submodules} --short'
|
|
|
|
alias gwS='git status --ignore-submodules=${_git_status_ignore_submodules}'
|
2012-01-20 22:32:17 -05:00
|
|
|
alias gwd='git diff --no-ext-diff'
|
2012-03-30 12:00:14 -04:00
|
|
|
alias gwD='git diff --no-ext-diff --word-diff'
|
2012-01-20 22:32:17 -05:00
|
|
|
alias gwr='git reset --soft'
|
|
|
|
alias gwR='git reset --hard'
|
|
|
|
alias gwc='git clean -n'
|
|
|
|
alias gwC='git clean -f'
|
|
|
|
alias gwx='git rm -r'
|
|
|
|
alias gwX='git rm -rf'
|
2011-09-05 00:37:36 -04:00
|
|
|
|