git zsh
69,177
Solution 1
You can add this to your git config and zsh won't check the status anymore
git config --add oh-my-zsh.hide-status 1git config --add oh-my-zsh.hide-dirty 1
Explanation
There are two central git functions in in lib/git.zsh:
git_prompt_info()
parse_git_dirty()
Each Method has a git config switch to disable it:
oh-my-zsh.hide-status
oh-my-zsh.hide-dirty
Some themes create their own git queries and sometimes ignore these flags.
Solution 2
Oh_my_zsh seems to be slow for some repos because it checks 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
Solution 3
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
Solution 4
It could be the theme calling git and rvm stuff after every command.
For me, changing ZSH_THEME="juanghurtadoto"
to ZSH_THEME="miloshadzic"
removed the 2 second delay after every command completely.
Themes can be found at https://github.com/robbyrussell/oh-my-zsh/wiki/themes
Solution 5
There are various way to speed up an oh-my-zsh
, as detailed in "zsh starts incredibly slowly", cleaning up the plugin section.
For instance, the blog post "Fix for oh-my-zsh git-svn prompt slowness" mentions the parse_git_dirty
function as a potential issue.
View more solutions
Share:
69,177
Related videos on Youtube
19 : 05
OH MY ZSH Tutorial - Bring Your Terminal To Another Level
Daniel Laera
65
12 : 42
Uninstall Oh My ZSH Right Now And Do This Instead
Brodie Robertson
40
12 : 10
Customize your terminal like a PRO!!! Powerlevel9k theme and Oh-my-zsh plugins [PART 2]
codeTalk
25
17 : 22
Top 10 Oh My Zsh Plugins For Productive Developers
Travis Media
25
20 : 01
[Part 3 of 3] How-To Customize GitBash by Converting GitBash to GitZSH + Oh-my-zsh + Plugins
Automation Dojos
5
03 : 00
git on zsh — you’re on 🔥 with the oh-my-zsh git plugin
Future Studio
5
09 : 19
git for Beginners (Part 11): Oh My Zsh! Tutorial - git Customizations and Shortcuts
Self Teach Me
4
54 : 03
Oh my! Please not another #Zsh tutorial - Part 2 - Oh My ZSH
DevInsideYou
4
Comments
-
Jason Swett about 1 year
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.I'm on Mac OS X if that matters.
Update: Turns out this line of my
.zshenv
is what was making it slow:[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
If I comment that line, it goes from taking about 3 seconds to taking about 1 second. Unfortunately, I need that line, since many of my projects use RVM. I don't know what to do now.
Update 2: this seems to be specifically an oh-my-zsh thing. If I don't load
~/.oh-my-zsh/oh-my-zsh.sh
, I don't have a problem.-
nneonneo over 10 years
and if you use bash now, is it still slow?
-
Jason Swett over 10 years
Excellent question. No, it's fast on bash.
-
user4815162342 over 10 years
Is it still slow if you move your
~/.z*
files out of the way? -
Jason Swett over 10 years
No. So I guess it's something in one of those.
-
Jason Swett over 10 years
Okay, the culprit seems to be
~/.oh-my-zsh/oh-my-zsh.sh
. I don't know what to do with this information, though. -
Jason Swett over 10 years
Narrowed it down even further and updated my answer.
-
Jason Swett over 10 years
Also, when I include
oh-my-zsh.sh
in my.zshrc
, it for some reason loads.zshenv
twice, which loads RVM twice, which must certainly make things slower than necessary. -
Senthil Kumar about 10 years
If the repo is big, calling git st everytime might slow the shell down. Use this option to turn it off. git config --add oh-my-zsh.hide-status 1
-
MEMark over 3 years
FYI this also occurs on WSL on Windows with Oh My Zsh.
-
-
Jason Swett over 10 years
That stuff helped in that it led me to start commenting stuff out to see what might make things load faster. I narrowed the problem down further and updated my question.
-
VonC over 10 years
Interesting. +1. This is more specific than my answer.
-
VonC over 10 years
Interesting feedback (more precise than my answer) +1
-
Jason Swett over 10 years
And it only took me 4 months to figure out!
-
VonC over 10 years
I find that fast! I know somes who take several years ;) meta.stackexchange.com/questions/36318/…
-
Raj over 9 years
The compinit post improved a small amount for me, but removing parse_git_dirty really sped things up. Thanks.
-
mblaettermann over 7 years
This solution still works, just tried this in my Symfony2 project folder. Maybe the vendor folder makes things slow, like the rake folder does for rails apps? zsh is fast now, and I do not need the GIT zsh plugin anyway. Thanks!
-
Leo Ufimtsev over 7 years
This solved my problem perfectly. I can still use the nice git-status business in other repos, but not in my huge firefox source code repo where git it slow.
-
nyxz over 6 years
git config --add oh-my-zsh.hide-status 1
speeds the things up but it completely removes the zsh status of the VCS. This one keeps it and still speeds it up. -
Gorm Casper over 6 years
I had to use
oh-my-zsh.hide-dirty
. It might have changed or maybe my theme (agnoster) only respectshide-dirty
. -
Bruno Buccolo over 6 years
Don't forget to update
oh-my-zsh
, otherwise yourlib/git.zsh
might completely ignore thehide-dirty
option. -
GabLeRoux about 6 years
Doing this in global settings for vagrant virtualbox vms with
--global
is really handy (slow in guest, fast on host) as described here: stackoverflow.com/a/40943155/1092815 <3 -
chris about 5 years
This answer added a big blank space at the end of my prompt. Not sure how to fix that.
-
Steve Yang over 3 years
What's the sdie effect?
-
SwimBikeRun over 3 years
Neither this nor the solution below help speed things up for me. Any ideas?
git status
is definitely the slow issue -
Johnathan Elmore over 3 years
git config --add oh-my-zsh.hide-dirty 1
was all I needed for my slow repo. -
Johnathan Elmore over 3 years
I was hoping this would do the trick, but no effect, even after source ~/.zshrc.
git config --add oh-my-zsh.hide-dirty 1
worked for me, though.git config --global --add oh-my-zsh.hide-dirty 1
to disable this for all repos. -
stwr667 about 3 years
@JohnathanElmore @Peeyush,
DISABLE_UNTRACKED_FILES_DIRTY="true"
doesn't do the same thing as theoh-my-zsh.hide-dirty
setting, even though they're similar. See the code here: github.com/ohmyzsh/ohmyzsh/blob/master/lib/git.zsh#L17. TheDISABLE_UNTRACKED_FILES_DIRTY
setting simply adds an--untracked-files=no
flag to thegit status
command, whereas theoh-my-zsh.hide-dirty 1
setting will skip the wholegit status
command altogether. I recommend @JohnathanElmore's suggestion of the global git config setting. -
n8gray about 2 years
A few notes about this solution: I also needed to remove
git-prompt
from my list of plugins and completely launch a new shell before things improved. (Despite the name, that plugin isn't required for git info in your prompt at all.) Just sourcing.zshrc
wasn't enough. Also FWIW, thetakashiyoshida
theme works great with these flags. -
Honghao Zhang about 2 years
git config --global --add oh-my-zsh.hide-dirty 1
I add this config to the global config. speeds up a lot -
Harpal almost 2 years
Updated second link
-
alper almost 2 years
I observe that
spacehip
makes terminal slower than its already it is. -
Sinux almost 2 years
not work for me with mac m1 on large file repository.
-
rangfu over 1 year
With this I was able to create a fast git-aware shell prompt with: export PS1="\u@\h \t \W [$txtcyn\]\$(git-branch-name) \[$txtrst\]\$ "
Recents
Why Is PNG file with Drop Shadow in Flutter Web App Grainy?
How to troubleshoot crashes detected by Google Play Store for Flutter app
Cupertino DateTime picker interfering with scroll behaviour
Why does awk -F work for most letters, but not for the letter "t"?
Flutter change focus color and icon color but not works
How to print and connect to printer using flutter desktop via usb?
Critical issues have been reported with the following SDK versions: com.google.android.gms:play-services-safetynet:17.0.0
Flutter Dart - get localized country name from country code
navigatorState is null when using pushNamed Navigation onGenerateRoutes of GetMaterialPage
Android Sdk manager not found- Flutter doctor error
Flutter Laravel Push Notification without using any third party like(firebase,onesignal..etc)
How to change the color of ElevatedButton when entering text in TextField