需求:今天需要對我的 git 提交的信息中的 name 和 email 進行修改;
原理:git的全局配置,存儲於$HOME/.gitconfig 裏,這裏的配置影響當前用戶的所有git repo。
方法1: 直接修改 $HOME/.gitconfig 文件,增加下面內容;
[user]
name = Rocco
email = [email protected]
方法2:
$ git config --global user.name
$ git config --global user.email [email protected]
延伸:修改默認編輯器,修改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