您的位置:首页 > 其它

gitconfig中磨刀不误砍柴工的小配置

2016-07-27 18:37 459 查看
1、 git config --global help.autocorrect 1,git命令自动纠错,如:git
stats会被自动纠正成git status执行


2、 git config --global core.autocrlf true,跨平台合作时的换行符问题,这个配置会帮你自动转换换行符(如果你是windows,配置为true)

AutoCRLF

#提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true
#提交时转换为LF,检出时不转换
git config --global core.autocrlf input
#提交检出均不转换
git config --global core.autocrlf false


SafeCRLF
#拒绝提交包含混合换行符的文件
git config --global core.safecrlf true
#允许提交包含混合换行符的文件
git config --global core.safecrlf false
#提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn


3、可视化对比工具p4merge(下载)。一般Idea等开发工具里都集成了可视化对比,BUT一个纯粹的可视化工具还是值得一试

下载安装p4merge,完成后执行以下配置,以后想要比较Git中的代码时,敲
git
difftool filepath
 即可

git config --global diff.tool p4merge
git config --global difftool.p4merge.cmd /Applications/p4merge.app/Contents/MacOS/p4merge
git config --global difftool.p4merge.cmd "/Applications/p4merge.app/Contents/Resources/launchp4merge \$LOCAL \$REMOTE"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: