1.首先找到.gitconfig文件
.gitconfig是隐藏文件,放在了用户目录下面:
执行命令:
cd ~
vim .gitconfig
[user]
name = my
email = my@xx.com
[alias]
st = status
ci = commit
co = checkout
br = branch
lg = log
[core]
autocrlf = input
excludesfile = /Users/my/.gitignore_global
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[commit]
template = /Users/my/.stCommitMsg
[credential]
helper = store
修改alias别名,就可以简化自己的git命令了 。
也可以命令行的方式去修改这个文件:
git config --global user.name "lilei"
git config --global user.email "demo@xx.com"
git config --global alias.st "status"