Skip to content

Instantly share code, notes, and snippets.

@kairyou
Last active August 13, 2019 01:10
Show Gist options
  • Save kairyou/91f7991a1ca2275935525e7db749f590 to your computer and use it in GitHub Desktop.
Save kairyou/91f7991a1ca2275935525e7db749f590 to your computer and use it in GitHub Desktop.
alias for git log, git branch log, git submodule log
# git -P lg -5 origin/master # --cherry --no-merges
git config --global alias.lg "\!f() { git log --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --graph \${@:q}; }; f"
# git -P sl submodulePath -5
git config --global alias.sl "\!f() { [[ -d \$1 ]] && cd \$1 && git log --pretty='%C(red)%h%C(reset) - %s %C(green)(%cr) %C(bold blue)<%an>%C(reset)' \${@:2}; }; f"
# git -P sul submodulePath -5
git config --global alias.sul "\!f(){ local IFS=\$'\n'; git submodule foreach -q '[[ \"\$name\" = \"'\$1'\" ]] && git log --pretty=\"%C(red)%h%C(reset) - %s %C(green)(%cr) %C(bold blue)<%an>%C(reset)\" '\${@:2}' || true'; };f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment