2020-02-04 14:27:44 +00:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
2020-05-28 11:29:49 +00:00
|
|
|
if ! exist git; then
|
|
|
|
return 1
|
2020-02-04 09:06:33 +00:00
|
|
|
fi
|
2020-05-28 11:29:49 +00:00
|
|
|
|
|
|
|
# git alias
|
|
|
|
|
|
|
|
alias g='git'
|
|
|
|
|
|
|
|
alias ga='git add'
|
|
|
|
alias gaa='git add --all'
|
|
|
|
alias gai='git add -i'
|
|
|
|
alias gb='git branch'
|
|
|
|
alias gbd='git branch -d'
|
|
|
|
|
|
|
|
alias gc='git commit -v'
|
|
|
|
alias gc!='git commit -v --amend'
|
|
|
|
alias gcn!='git commit -v --no-edit --amend'
|
|
|
|
|
|
|
|
alias gcm='git checkout master'
|
|
|
|
alias gcd='git checkout develop'
|
|
|
|
alias gcb='git checkout -b'
|
|
|
|
alias gco='git checkout'
|
|
|
|
|
|
|
|
alias gd='git diff'
|
|
|
|
alias gds='git diff --staged'
|
|
|
|
|
|
|
|
alias gi='git ignore'
|
|
|
|
|
2020-05-28 12:01:50 +00:00
|
|
|
# show last committed content
|
|
|
|
alias gll='git last'
|
|
|
|
# show quick log overview
|
2020-05-28 11:29:49 +00:00
|
|
|
alias glg='git log --oneline --decorate --graph'
|
|
|
|
alias glga='git log --oneline --decorate --graph --remotes --all'
|
2020-05-28 12:01:50 +00:00
|
|
|
# show detailed log overview
|
|
|
|
alias glog='git log --stat'
|
|
|
|
# show detailed log overview with contents
|
|
|
|
alias gloog='git log --stat -p'
|
2020-05-28 11:29:49 +00:00
|
|
|
|
|
|
|
alias gf='git fetch'
|
|
|
|
alias gl='git pull'
|
|
|
|
|
|
|
|
alias gpn='git push --dry-run'
|
|
|
|
alias gp='git push'
|
|
|
|
alias gpf!='git push --force'
|
|
|
|
alias gpm='git pushmerge'
|
2020-09-18 15:12:21 +00:00
|
|
|
alias gpa='git pushall'
|
2020-05-28 11:29:49 +00:00
|
|
|
|
|
|
|
alias grv='git remote -v'
|
|
|
|
|
|
|
|
alias grs='git restore --staged'
|
|
|
|
alias grs!='git restore'
|
|
|
|
|
2020-09-18 15:17:48 +00:00
|
|
|
alias grb='git rebase'
|
2020-05-28 11:29:49 +00:00
|
|
|
alias grbi='git rebase -i'
|
|
|
|
alias grbc='git rebase --continue'
|
|
|
|
alias grbm='git rebase master'
|
|
|
|
|
|
|
|
alias gst='git status'
|
|
|
|
|
|
|
|
# if git is at least version 2.13, we can use git stash push
|
|
|
|
# in shells other than zsh, simply fall back to save
|
|
|
|
case "$(ps -cp "$$" -o command="")" in
|
|
|
|
*zsh*)
|
|
|
|
autoload -Uz is-at-least
|
|
|
|
if is-at-least 2.13 "$(git --version 2>/dev/null | awk '{print $3}')"; then
|
|
|
|
alias gsta='git stash push'
|
|
|
|
else
|
|
|
|
alias gsta='git stash save'
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*) alias gsta='git stash save' ;;
|
|
|
|
esac
|
|
|
|
alias gstp='git stash pop'
|
|
|
|
alias gstl='git stash list'
|
|
|
|
alias gstL='git stash list --stat'
|