Skip to content

Instantly share code, notes, and snippets.

@mightbxg
Last active October 25, 2021 12:01
Show Gist options
  • Save mightbxg/b6c15285694059df5a696c587aea7982 to your computer and use it in GitHub Desktop.
Save mightbxg/b6c15285694059df5a696c587aea7982 to your computer and use it in GitHub Desktop.
commonly used git alias

设置别名:

git config --global alias.%ALIAS% %COMMAND%

显示已设置的别名:

git config --get-regexp alias

常用别名:

git config --global alias.ls "log --pretty=format:'%C(yellow)%h %C(blue)%ad %C(red)%d %C(reset)%s %C(green)[%cn]' --decorate --date=short"
git config --global alias.lss "log --no-merges --color --stat --graph --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Cblue %s %Cgreen(%cd) %C(bold blue)<%an>%Creset' --abbrev-commit"
git config --global alias.line "log --oneline"
git config --global alias.latest "for-each-ref --sort=-committerdate --format='%(committerdate:short) %(refname:short) [%(committername)]'"
git config --global alias.hist "log --pretty=format:'%C(yellow)%h %C(red)%d %C(reset)%s %C(green)[%an] %C(blue)%ad' --topo-order --graph --date=short"
git config --global alias.pushall '!git remote | xargs -L1 git push --all'
git config --global alias.ignored '!git ls-files -v | grep "^[[:lower:]]"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment