零、概述

记录各个领域的小技巧。

一、git

1 命令技巧

1.1 取别名

有些git命令使用很频繁且长度不算短,所以可以为常用命令来设置一个别名,这样更快捷。

格式如下:

1
git config --global alias.xx xxxxx

其中xx就是别名,xxx则是原来的git命令。例如简化git status就可以这么设置。

1
git config --global alias.st status

后续只要使用git st就可以表示git status,如图:

image-20250630220228650

常用别名如下:

1
git config --global alias.lg "log --no-merges --color --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"