windows 10 git bash 提速方法

具体设置方法

方式1

You can significantly speed up Git on Windows by running three commands to set some config options:

git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256

Notes:

  • core.preloadindex does filesystem operations in parallel to hide latency (update: enabled by default in Git 2.1)

  • core.fscache fixes UAC issues so you don’t need to run Git as administrator (update: enabled by default in Git for Windows 2.8)

  • gc.auto minimizes the number of files in .git/

方式2

备注:可以方式1 方式2 都设置,设置了方式1 感觉提升不大
修改 git 配置文件 profile(我的路径为 C:\Program Files\Git\etc)
添加位置为profile PS1 最后出现位置的下方 我的是
在这里插入图片描述

添加内容:

fast_git_ps1 ()
{
    printf -- "$(git branch 2>/dev/null | sed -ne '/^\* / s/^\* \(.*\)/ [\1] / p')"
}

PS1='\[\033]0;$MSYSTEM:\w\007
\033[32m\]\u@\h \[\033[33m\w$(fast_git_ps1)\033[0m\]
$ '

这么设置的原因,是因为,git bash 格式化输出、渲染太多,导致执行命令后,反应较慢

方式3

执行命令

export PS1='$'

这个设置是 格式化输出替换为 $ 符号,速度提升较大 效果如下
在这里插入图片描述

方式4

卸载-重启-安装,一路next,使用默认配置。(知乎方法,并未尝试)

效果对比

设置 方式1 方式2 前

​​​​​​在这里插入图片描述

设置 方式1 方式2 后

在这里插入图片描述

其他

查看当前系统用户目录

  • 在cmd下输入echo %USERPROFILE% 或者 cmd 下输入 set HOME

调试 git status 命令

  • GIT_TRACE=true git status

显示耗时

  • time GIT_TRACE=true git status

参考链接

1、Diagnosing performance issues
2、painfully - git status slow
3、installer: offer the builtin stash/rebase as experimental options
4、Git Bash is extremely slow on Windows 7 x64
5、Git commands have a 2-3 second delay before returning to the prompt #1070
6、What is the meaning of these Windows Environment variables: HOMEDRIVE, HOMEPATH, HOMESHARE, USERPROFILE
7、提高win10 系统 git 速度的方法

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值