初始化
用户名&邮箱设置
git config --global user.name{name}
git config --global user.email{email}
免密码设置
-
在用户目录下创建.git-credentials文件,并输入以下内容
http://{username}:{password}@10.35.52.34
-
运行以下命令
git config --global credential.helper store
http最大缓存设置
git config --global http.postBuffer 524288000
大小写敏感设置
git config --global core.ignorecase false
本地文件状态
git status -s
本地分支与远端track关系
git branch -vv
创建本地分支并关联
git branch {branchname}
git push -u origin HEAD
删除远端已合并的本地分支
git fetch -p
git branch -vv | grep ':gone]' |sed 's/^\s\s//' | sed 's/\s.*$//g' | grep -v master | xargs -n 1 git branch -d
配置diff及merge工具
-
diff
git config --global diff.tool {toolname} git config --global difftool.{toolname}.path "{path}"
示例:
git config --global diff.tool bc4 git config --global difftool.bc4.path "D:\soft\BC4\BComp.exe"
-
merge
git config --global merge.tool {toolname} git config --global mergetool.{toolname}.path "{path}"