转自 https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/git/git.plugin.zsh

alias g='git'

alias ga='git add'
alias gaa='git add --all'
alias gapa='git add --patch'
alias gau='git add --update'
alias gav='git add --verbose'
alias gap='git apply'

alias gb='git branch'
alias gba='git branch -a'
alias gbd='git branch -d'
alias gbda='git branch --no-color --merged | command grep -vE "^(\*|\s*(master|develop|dev)\s*$)" | command xargs -n 1 git branch -d'
alias gbl='git blame -b -w'
alias gbnm='git branch --no-merged'
alias gbr='git branch --remote'
alias gbs='git bisect'
alias gbsb='git bisect bad'
alias gbsg='git bisect good'
alias gbsr='git bisect reset'
alias gbss='git bisect start'

alias gc='git commit -v'
alias gc!='git commit -v --amend'
alias gcn!='git commit -v --no-edit --amend'
alias gca='git commit -v -a'
alias gca!='git commit -v -a --amend'
alias gcan!='git commit -v -a --no-edit --amend'
alias gcans!='git commit -v -a -s --no-edit --amend'
alias gcam='git commit -a -m'
alias gcsm='git commit -s -m'
alias gcb='git checkout -b'
alias gcf='git config --list'
alias gcl='git clone --recursive'
alias gclean='git clean -fd'
alias gpristine='git reset --hard && git clean -dfx'
alias gcm='git checkout master'
alias gcd='git checkout develop'
alias gcmsg='git commit -m'
alias gco='git checkout'
alias gcount='git shortlog -sn'
compdef _git gcount
alias gcp='git cherry-pick'
alias gcpa='git cherry-pick --abort'
alias gcpc='git cherry-pick --continue'
alias gcs='git commit -S'

alias gd='git diff'
alias gdca='git diff --cached'
alias gdcw='git diff --cached --word-diff'
alias gdct='git describe --tags `git rev-list --tags --max-count=1`'
alias gdt='git diff-tree --no-commit-id --name-only -r'
alias gdw='git diff --word-diff'

gdv() { git diff -w "$@" | view - }
compdef _git gdv=git-diff

alias gf='git fetch'
alias gfa='git fetch --all --prune'
alias gfo='git fetch origin'

function gfg() { git ls-files | grep $@ }
compdef _grep gfg

alias gg='git gui citool'
alias gga='git gui citool --amend'

ggf() {
  [[ "$#" != 1 ]] && local b="$(git_current_branch)"
  git push --force origin "${b:=$1}"
}
ggfl() {
[[ "$#" != 1 ]] && local b="$(git_current_branch)"
git push --force-with-lease origin "${b:=$1}"
}
compdef _git ggf=git-checkout

ggl() {
  if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
    git pull origin "${*}"
  else
    [[ "$#" == 0 ]] && local b="$(git_current_branch)"
    git pull origin "${b:=$1}"
  fi
}
compdef _git ggl=git-checkout

ggp() {
  if [[ "$#" != 0 ]] && [[ "$#" != 1 ]]; then
    git push origin "${*}"
  else
    [[ "$#" == 0 ]] && local b="$(git_current_branch)"
    git push origin "${b:=$1}"
  fi
}
compdef _git ggp=git-checkout

ggpnp() {
  if [[ "$#" == 0 ]]; then
    ggl && ggp
  else
    ggl "${*}" && ggp "${*}"
  fi
}
compdef _git ggpnp=git-checkout

ggu() {
  [[ "$#" != 1 ]] && local b="$(git_current_branch)"
  git pull --rebase origin "${b:=$1}"
}
compdef _git ggu=git-checkout

alias ggpur='ggu'
compdef _git ggpur=git-checkout

alias ggpull='git pull origin $(git_current_branch)'
compdef _git ggpull=git-checkout

alias ggpush='git push origin $(git_current_branch)'
compdef _git ggpush=git-checkout

alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
alias gpsup='git push --set-upstream origin $(git_current_branch)'

alias ghh='git help'

alias gignore='git update-index --assume-unchanged'
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
alias git-svn-dcommit-push='git svn dcommit && git push github master:svntrunk'
compdef _git git-svn-dcommit-push=git

alias gk='\gitk --all --branches'
compdef _git gk='gitk'
alias gke='\gitk --all $(git log -g --pretty=%h)'
compdef _git gke='gitk'

alias gl='git pull'
alias glg='git log --stat'
alias glgp='git log --stat -p'
alias glgg='git log --graph'
alias glgga='git log --graph --decorate --all'
alias glgm='git log --graph --max-count=10'
alias glo='git log --oneline --decorate'
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"
alias glod="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset'"
alias glods="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset' --date=short"
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"
alias glog='git log --oneline --decorate --graph'
alias gloga='git log --oneline --decorate --graph --all'
alias glp="_git_log_prettily"
compdef _git glp=git-log

alias gm='git merge'
alias gmom='git merge origin/master'
alias gmt='git mergetool --no-prompt'
alias gmtvim='git mergetool --no-prompt --tool=vimdiff'
alias gmum='git merge upstream/master'
alias gma='git merge --abort'

alias gp='git push'
alias gpd='git push --dry-run'
alias gpoat='git push origin --all && git push origin --tags'
compdef _git gpoat=git-push
alias gpu='git push upstream'
alias gpv='git push -v'

alias gr='git remote'
alias gra='git remote add'
alias grb='git rebase'
alias grba='git rebase --abort'
alias grbc='git rebase --continue'
alias grbd='git rebase develop'
alias grbi='git rebase -i'
alias grbm='git rebase master'
alias grbs='git rebase --skip'
alias grh='git reset'
alias grhh='git reset --hard'
alias grmv='git remote rename'
alias grrm='git remote remove'
alias grset='git remote set-url'
alias grt='cd $(git rev-parse --show-toplevel || echo ".")'
alias gru='git reset --'
alias grup='git remote update'
alias grv='git remote -v'

alias gsb='git status -sb'
alias gsd='git svn dcommit'
alias gsi='git submodule init'
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 gstaa='git stash apply'
alias gstc='git stash clear'
alias gstd='git stash drop'
alias gstl='git stash list'
alias gstp='git stash pop'
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 gwch='git whatchanged -p --abbrev-commit --pretty=medium'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip-- [skip ci]"'

zsh中git快捷键相关推荐

  1. 关闭git命令窗快捷键_zsh中git的快捷命令

    zsh 中git的快捷键命令 g='git' ga='git add' gaa='git add --all' gapa='git add --patch' gau='git add --update ...

  2. 收藏!工作中Git使用实践和常用命令流程合集

    来自:匠心Java 工作中git是一项必不可少的技能,在项目的开发进程中起着至关重要的作用 下面介绍一些git在工作中的一些使用实践.常用流程.常用命令,供大家参考! 一:前言 Git的定义是:分布式 ...

  3. git 只merge部分_[Skill]俩小时掌握多人开发中git的主要用法

    前言 几个月前看完了git文档,但是在实际开发中对很多git命令的具体影响仍有疑惑,比方说pull.fetch和rebase三个命令和检出位置拎不清. Git - Book​git-scm.com 安 ...

  4. linux+输出分页,是否可以在zsh中自动分页输出?

    有时我们在终端运行一个命令,输出太大,我们忘了把"| less"放到最后.所以我想知道当zsh中的输出太大时可以分页输出吗? 我尝试使用python和less实现此功能: #!/u ...

  5. webstorm中git密码输入错误,重置问题

    webstorm中git密码输入错误,重置问题 今天遇到了一个问题. 因为我比较习惯使用webstorm编辑器,特别喜欢直接用里面的git工具. 当从远程仓库fetch下来代码时,提示输入用户名密码. ...

  6. C#中的快捷键,可以更方便的编写代码

    C#中的快捷键,可以更方便的编写代码 CTRL + SHIFT + B 生成解决方案 CTRL + F7 生成编译 CTRL + O 打开文件 CTRL + SHIFT + O 打开项目 CTRL + ...

  7. import 快捷键 自动调整顺序_一文搞定PPT中的快捷键

    不知道大家有没有见到过会PS的同学工作时的场景:一手鼠标移动.指点,另一手在键盘上噼里啪啦按键,屏幕上肉眼可见的速度出现了他们的作品. 操作速度非常快,非常让人羡慕他们的熟练程度. 他们对PS的快捷键 ...

  8. wpf怎么让grid表格中元素显示到最顶层_一文搞定PPT中的快捷键

    点击上方"锦乡悦堂",一起愉快的学习吧! 不知道大家有没有见到过会PS的同学工作时的场景:一手鼠标移动.指点,另一手在键盘上噼里啪啦按键,屏幕上肉眼可见的速度出现了他们的作品. 操 ...

  9. 【Qt】Qt中的快捷键汇总

    简介 Qt Creator中提供了各种快捷键来加快开发进程. 如果需要查看或自定义快捷键,选择工具->选项->环境->键盘.快捷键按类别列出,可以在过滤器(Filter)处输入命令名 ...

最新文章

  1. 单元测试框架怎么搭?快来看看新版Junit5的这些神奇之处吧!
  2. .NET中如何得到图片大小
  3. 2020上半年收集到的优质AI文章 – 计算机视觉
  4. java打印出继承体系的类(包括抽象类)、接口、域字段
  5. HashMap的负载因子为什么默认是0.75
  6. 必须要改变这样的生活
  7. 【LeetCode从零单排】No.7 Reverse Integer
  8. 《C++ Primer》14.4节练习(部分)
  9. linux中安装cx_Oracle
  10. vue jsx 使用 自定义组件
  11. [Ext JS6实战]动态数据绑定
  12. LeetCode简单题目(#225 #226 #231 #232 #234)-5道(栈、队列、树、数字)
  13. c语言按照字节读取任何文件,【文件操作】【按字节读取】求鉴定问题……
  14. Senparc.Weixin.MP SDK 微信公众平台开发教程(十):多客服接口说明
  15. Cocos2d-x schedulers 定时器
  16. 想找一些外文文献,有哪些靠谱的外文文献网站推荐?
  17. 智能优化算法学习总结
  18. 麻省理工学院公开课:计算机科学及编程导论习题4下
  19. 一行代码显示WiFi密码
  20. 浏览器获取图片出现跨域问题

热门文章

  1. 基于模板的云服务视频自动生成解决方案
  2. rhce考试linux环境,RHCSA考试题及RHCE考试题
  3. 乐吾乐零部件拆解可视化解决方案
  4. CAD打印怎么布满图纸?
  5. iPhone手机数据找回指南2:iPhone手机使用技巧
  6. RS-485电路设计及接口防护
  7. Vue 项目实战五 参数管理 商品列表
  8. LTE(4G) - NR(5G) RSRP和SINR RSRQ RSSI LTE信号质量
  9. python_爬虫_豆瓣TOP250_url
  10. 一些数据采集卡使用过程中常见问题