oh-my-zsh slow, but only for certain Git repo

I recently started using Zsh and it’s awesome. Unfortunately, for the project I consider my “main” project, everything is slow. What I mean is that every time I run a command – ls, for example – there’s about a five second delay between the time the command is executed and the time I can use the terminal again.

What could be different about this one repo that makes Zsh so slow? I assume it’s a Zsh-specific thing because there was no problem before I started using Zsh. I tried doing a git clean but it didn’t make any noticeable difference.

Detailed Answer:
There are two central git functions (git_prompt_info() and parse_git_dirty()) in lib/git.zsh. Each Method has a git config switch to disable it
(oh-my-zsh.hide-status and oh-my-zsh.hide-dirty)

Oh_my_zsh seems to be slow for some repos where the because it check the status of the repo after each command.
This behaviour can be overridden in the new version of .oh_my_zsh .
Just Uncomment the following line in .zshrc:

DISABLE_UNTRACKED_FILES_DIRTY=”true”

After this, restart your terminal or run the following:

source ~/.zshrc

Questions:

Answers:

I finally figured it out. My project had a rake folder with a ton of files (like 20,000). I have no idea what that folder was there for, but I deleted it, Zsh is no longer slow, and my app still seems to work.

Questions:

Answers:

For me it’s slow on VirtualBox (the guest) because I’m using a synced folder. I still want it enabled on OS X (the host) where it’s fast enough. Instead of using a local config setting which is stored with the repo and would change it both on the guest and host, I use a global config setting only on the guest:

git config --global --add oh-my-zsh.hide-dirty 1

If I want it just for a single repo:

git config --add oh-my-zsh.hide-dirty 1

Questions:

Answers:

If you don’t care about another version control programs but git, you can just disable all vcs_infos in your *.zsh-theme and replace them with native git commands.

For example I tweak my agnoster.zsh-theme by:

comment/remove all lines that have vcs_info,

edit code in prompt_git() function from:

ref="$vcs_info_msg_0_" to

ref="$(git branch 2>/dev/null | grep -Po '(?<=\* ).*$')"

So, basically, I just disabled all vcs_info actions, and instead use a native git command for checking statuses of the repo. As a result, I still can see my useful git prompt with a speed as fast as working in a non-git directory. With this small modification, my zsh can work 4-5x faster within git repos.

Note: use GNU grep not BSD grep.

Questions:

Answers:

Probably the most simple and reliable workaround that I could come up with was to just type

bash

I did this in the directory with my huge git repository and everything works great.