Skip to content

Instantly share code, notes, and snippets.

@Noiled
Forked from ifduyue/add-git-aliases.sh
Created October 11, 2021 02:31
Show Gist options
  • Save Noiled/05d1c01443117d524254d657010bb6ef to your computer and use it in GitHub Desktop.
Save Noiled/05d1c01443117d524254d657010bb6ef to your computer and use it in GitHub Desktop.
git aliases
#!/bin/bash
set -x
# common shortcuts
git config --global alias.co checkout
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.br branch
git config --global alias.rb rebase
git config --global alias.mg merge
# [modified] from and http://tech.tulentsev.com/2012/11/pretty-log-in-git/ http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
git config --global alias.plog "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%ae>%Creset' --abbrev-commit"
git config --global alias.ls 'log --pretty=format:"%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]" --decorate'
git config --global alias.ll 'log --pretty=format:"%C(yellow)%h%Cred%d %Creset%s%Cblue [%cn]" --decorate --numstat'
git config --global alias.lnc 'log --pretty=format:"%h %s [%cn]"'
git config --global alias.lds 'log --pretty=format:"%C(yellow)%h %ad%Cred%d %Creset%s%Cblue [%cn]" --decorate --date=short'
git config --global alias.ld 'log --pretty=format:"%C(yellow)%h %ad%Cred%d %Creset%s%Cblue [%cn]" --decorate --date=relative'
git config --global alias.le 'log --oneline --decorate'
git config --global alias.filelog 'log -u'
git config --global alias.fl 'log -u'
git config --global alias.dl '!git ll -1'
git config --global alias.dlc 'diff --cached HEAD^'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment