Open4
自分の使っているAliasをまとめたい
Git Alias
.zshrc
# git alias
alias g="git"
.gitconfig
# git alias
[alias]
a = "!git status --short | peco | awk '{print $2}' | xargs git add"
d = diff
co = checkout
ci = commit
ca = commit -a
ps = "!git push origin $(git rev-parse --abbrev-ref HEAD)"
pl = "!git pull origin $(git rev-parse --abbrev-ref HEAD)"
st = status
br = branch
ba = branch -a
bm = branch --merged
bn = branch --no-merged
df = "!git hist | peco | awk '{print $2}' | xargs -I {} git diff {}^ {}"
hist = log --pretty=format:\"%Cgreen%h %Creset%cd %Cblue[%cn] %Creset%s%C(yellow)%d%C(reset)\" --graph --date=relative --decorate --all
llog = log --graph --name-status --pretty=format:\"%C(red)%h %C(reset)(%cd) %C(green)%an %Creset%s %C(yellow)%d%Creset\" --date=relative
open = "!hub browse"
type = cat-file -t
dump = cat-file -p
find = "!f() { git log --pretty=format:\"%h %cd [%cn] %s%d\" --date=relative -S'pretty' -S\"$@\" | peco | awk '{print $1}' | xargs -I {} git diff {}^ {}; }; f"
# edit conflicted file on merge
edit-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; vim `f`"
# add conflicted file on merge
add-unmerged = "!f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`"
Takuyaさんが紹介していたGit Aliasを使っています。
llog
やhist
は感動もの。すごく見やすい。
Docker Alias
.zshrc
# docker alias
alias dk='docker'
alias dp='docker ps'
alias dcu='docker compose up'
alias dcd='docker compose down'
alias dcs='docker compose stop'
alias dcr='docker compose restart'
alias dcx='(){docker compose exec -it $1 /bin/bash}'
dcu
に-d
を含めるかはお好み。
Zsh Alias
.zshrc
# zsh alias
alias czsh='code ~/.zshrc'
alias szsh='source ~/.zshrc'