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`"

https://zenn.dev/takuya/articles/7550d21ddd17f121602e

Takuyaさんが紹介していたGit Aliasを使っています。
lloghistは感動もの。すごく見やすい。

おかしなパンおかしなパン

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を含めるかはお好み。