はじめに
@ohakutsu が alias の記事を書いていたので私も利用している alias を書いてみました
設定してる Git aliase
.gitconfig
や .zshrc
は dotfiles レポジトリに保存しています
その中で Git に関連するもの ( かつ よく使うもの ) だけ記載します
Zsh
alias g='git'
Git
[alias]
ad = add
ci = commit
co = checkout
cop = !"git branch --all | tr -d '* ' | grep -v -e '->' | peco | sed -e 's+remotes/[^/]*/++g' | xargs git checkout"
d1 = diff HEAD~
d2 = diff HEAD~~
d3 = diff HEAD~~~
d4 = diff HEAD~~~~
d5 = diff HEAD~~~~~
dc = diff --cached
delete-merged-branches = !git branch --merged | grep -vE '^\\*|master$|main$|develop$' | xargs -I % git branch -d %
dmas = diff master
dmai = diff main
ds = diff --staged
dw = diff --color-words
fe = fetch
ignore = "!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi"
pl = pull
st = status
Ref: https://github.com/mziyut/dotfiles/blob/master/.gitconfig