需求:今天需要对我的 git 提交的信息中的 name 和 email 进行修改;
原理:git的全局配置,存储于$HOME/.gitconfig 里,这里的配置影响当前用户的所有git repo。
方法1: 直接修改 $HOME/.gitconfig 文件,增加下面内容;
[user]
name = Rocco
email = handsomerocco@gmail.com
方法2:
$ git config --global user.name
$ git config --global user.email handsomerocco@gmail.com
延伸:修改默认编辑器,修改Alias等,最终都保存在 $HOME/.gitconfig
需求:今天需要对我的 git 中的 显示颜色方案 进行修改;
git config --global color.diff auto # git diff 要顯示顏色
git config --global color.status auto # git status 要顯示顏色
git config --global color.branch auto