1、安装brew
官网有安装方法https://brew.sh
2、执行
brew install git
brew install bash-completion
3、修改 .bash_profile
如果没有该文件可以自行创建(touch .bash_profile)
打开文件(open .bash_profile)
增加内容
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
4、完全退出终端,重启即可正常使用
5、设置自动调整结束符,不同平台编码结束符不同
- CRLF是回车换行->windows-style
- LF是换行->unix-style
- CR是回车->mac-style
git config --global core.autocrlf input
参数:
- true,在提交时,自动将CRLF转换成LF,在签出代码时将LF转换成CRLF。
- false,取消转换。
- input,签出文件时根据平台转化。