Skip to content

Instantly share code, notes, and snippets.

@geelen
Created January 26, 2023 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geelen/e9db4672f4b40506e00409c84e677d95 to your computer and use it in GitHub Desktop.
Save geelen/e9db4672f4b40506e00409c84e677d95 to your computer and use it in GitHub Desktop.
ZSH aliases

Replace ls and tree with exa:

alias exa='exa --icons'
alias ll='exa -laTL 1'
alias ll2='exa -laTL 2'
alias ll3='exa -laTL 3'
alias ll4='exa -laTL 4'
alias tree='ll -L 99'

image

export git_concise_log_format='--pretty=format:%Cblue%h%d%Creset %ar %Cgreen%an%Creset %s'

git_current_branch() {
  git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///'
}

alias ga='git add'
alias gap='ga -p'
alias gau='git add -u'
alias gbr='git branch -v'
alias gc='git commit -v'
alias gca='gc -a'
alias gcam='gca --amend'
alias gcf='git config -l'
alias gch='git cherry-pick'
alias gcm='gc --amend'
alias gco='git checkout'
alias gcop='gco -p'
alias gd='git diff -M'
alias gd.='git diff -M --color-words="."'
alias gdw='git diff $color_ruby_words'
alias gdc='git diff --cached -M'
alias gdc.='git diff --cached -M --color-words="."'
alias gdcw='git diff --cached $color_ruby_words'
alias gds='gitd --stat'
alias gf='git fetch'
alias glog='git log $git_concise_log_format'
alias gl='glog --graph'
alias gla='gl --all'
alias gl_absolute='git log --graph --pretty=format:"%Cblue%h%d%Creset %ad %Cgreen%an%Creset %s"'
gls() {
  query="$1"
  shift
  glog --pickaxe-regex "-S$query" "$@"
}
alias gm='git merge --no-ff'
alias gmf='git merge --ff-only'
alias gp='git push'
alias gpthis='git push origin HEAD:$(git_current_branch)'
alias gpb='git push banana'
alias gpd='gp deploy deploy'
alias gpt='gp --tags'
alias gr='git reset'
alias grb='git rebase --rebase-merges'
alias grbc='git rebase --continue'
alias grbi='git rebase -i'
alias grh='git reset --hard'
alias grp='gr --patch'
alias grs='git reset --soft'
alias grsh='git reset --soft HEAD~'
alias grv='git remote -v'
alias gs='git show'
alias gs.='git show --color-words="."'
alias gss='gs --stat'
alias gst='git stash'
alias gstp='git stash pop'
alias gstwc='gst save --keep-index'
alias gup='git smart-pull'
alias gab='gm $argv && gbr -d $argv'
alias gmd='gm $argv && gbr -d $argv $argv && glcg'
alias graf='git remote add $argv[1] $argv[2] && gf $argv[1]'
alias p='pnpm'
alias px='pnpm dlx'
alias pa='pnpm add'
alias pad='pnpm add -D'
alias pap='pnpm add -P'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment