Git使用技巧
存储登录信息
输入以下命令:
保存密码
$ git config --global credential.helper cache
保存密码的时间,单位秒
$ git config --global credential.helper 'cache --timeout=7200'
error: RPC failed; result=22, HTTP code = 411
Git提交信息时,提示:
error: RPC failed; result=22, HTTP code = 411
fatal: The remote end hung up unexpectedly
git push提交文件时超出post限制了,执行:
$ git config http.postBuffer 524288000
Git批量删除文件
$ git add -A
会寻找新文件、临时修改的、已经删除的。
$ git commit -a
会自动标记已修改和删除的文件
之后push即可。
统计Git提交次数
$ git log | grep -e 'commit [a-zA-Z0-9]*' | wc -l
设置不同的人员信息
Projects 此目录下只放公司项目
Sites 此目录下只放个人项目
.gitconfig
[user] name = baijunyao email = baijunyao@baijunyao.com [core] excludesfile = ~/Sites/gitconfig/.gitignore_global [includeIf "gitdir:~/Sites/"] path = ~/Sites/gitconfig/.gitconfig-individual [includeIf "gitdir:~/Projects/"] path = ~/Sites/gitconfig/.gitconfig-company
Projects/.gitconfig-company
[user] name = Junyao Bai email = junyao.bai@company.com
Sites/.gitconfig-individual
[user] name = baijunyao email = "baijunyao@baijunyao.com"
~/.gitconfig
[include] path = ~/Sites/gitconfig/.gitconfig