git branch switch需要半分钟?

时间:2015-01-09 22:46:38

标签: macos git performance

从工作中获得了更强大,更新鲜的机器,开始安装开发工具,这简直就是噩梦,我从未在旧机器上遇到过性能问题git 。这是无可非议的:

ons-mbp:spec ALE$ time git checkout fsfs

Switched to branch 'fsfs'

real    0m30.080s
user    0m0.007s
sys 0m0.006s

    ons-mbp:spec ALE$ time git checkout master

Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

real    0m30.083s
user    0m0.007s
sys 0m0.007s

尝试重新安装不同的git版本,尝试通过自制程序和手动 - 零效果。

任何人都可以提供提示吗?

操作系统版本:10.9.5

1 个答案:

答案 0 :(得分:4)

在进行全新安装时完全忘记了设置全局用户详细信息。

 git config --global user.name "Test Test"
 git config --global user.email "testgmail.com"

致记:

"I normally do this right away when setting up my account on a new machine. The fresh install didn't trigger that reflex. I'm surprised that this is needed to keep git from preforming silly DNS lookups but no big deal."

ons-mbp:spec ALE$ time git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

real    0m0.012s
user    0m0.006s
sys 0m0.005s
ons-mbp:spec ALE$ time git checkout fsfs
Switched to branch 'fsfs'

real    0m0.012s
user    0m0.006s
sys 0m0.005s

免于心脏病发作。