八:配置别名

来源:互联网 发布:在上海工作的感受 知乎 编辑:程序博客网 时间:2024/05/22 06:12

1. --global参数是全局参数,这些命令在这台电脑的所有GIT仓库下都有用

git config --global alias.别名 原来命令

a. git config --global alias.st status

git st

b. git config --global alias.unstage 'reset HEAD'

git unstage

以下是实用命令:

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"

2.配置文件

a. --global是针对当前用户起作用,如果不加,那只针对当前的仓库起作用

b. 每个仓库的git配置文件都放在.git/config文件中

c. 当前用户的git配置文件放在用户主目录下的一个隐藏文件.gitconfig中


原创粉丝点击