[Solved] oh-my-zsh slow, but only for certain Git repo (2023)

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

[Solved] oh-my-zsh slow, but only for certain Git repo (1)

19 : 05

OH MY ZSH Tutorial - Bring Your Terminal To Another Level

Daniel Laera

65

[Solved] oh-my-zsh slow, but only for certain Git repo (2)

12 : 42

Uninstall Oh My ZSH Right Now And Do This Instead

Brodie Robertson

40

[Solved] oh-my-zsh slow, but only for certain Git repo (3)

12 : 10

Customize your terminal like a PRO!!! Powerlevel9k theme and Oh-my-zsh plugins [PART 2]

codeTalk

25

[Solved] oh-my-zsh slow, but only for certain Git repo (4)

17 : 22

Top 10 Oh My Zsh Plugins For Productive Developers

Travis Media

25

[Solved] oh-my-zsh slow, but only for certain Git repo (5)

20 : 01

[Part 3 of 3] How-To Customize GitBash by Converting GitBash to GitZSH + Oh-my-zsh + Plugins

Automation Dojos

5

[Solved] oh-my-zsh slow, but only for certain Git repo (6)

03 : 00

git on zsh — you’re on 🔥 with the oh-my-zsh git plugin

Future Studio

5

[Solved] oh-my-zsh slow, but only for certain Git repo (7)

09 : 19

git for Beginners (Part 11): Oh My Zsh! Tutorial - git Customizations and Shortcuts

Self Teach Me

4

[Solved] oh-my-zsh slow, but only for certain Git repo (8)

54 : 03

Oh my! Please not another #Zsh tutorial - Part 2 - Oh My ZSH

DevInsideYou

4

[Solved] oh-my-zsh slow, but only for certain Git repo (9)

Author by

Jason Swett

Author of Code with Jason

Updated on March 19, 2022

Comments

  • [Solved] oh-my-zsh slow, but only for certain Git repo (10)

    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.

    • [Solved] oh-my-zsh slow, but only for certain Git repo (11)

      nneonneo over 10 years

      and if you use bash now, is it still slow?

    • [Solved] oh-my-zsh slow, but only for certain Git repo (12)

      Jason Swett over 10 years

      Excellent question. No, it's fast on bash.

    • [Solved] oh-my-zsh slow, but only for certain Git repo (13)

      user4815162342 over 10 years

      Is it still slow if you move your ~/.z* files out of the way?

    • [Solved] oh-my-zsh slow, but only for certain Git repo (14)

      Jason Swett over 10 years

      No. So I guess it's something in one of those.

    • [Solved] oh-my-zsh slow, but only for certain Git repo (15)

      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.

    • [Solved] oh-my-zsh slow, but only for certain Git repo (16)

      Jason Swett over 10 years

      Narrowed it down even further and updated my answer.

    • [Solved] oh-my-zsh slow, but only for certain Git repo (17)

      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.

    • [Solved] oh-my-zsh slow, but only for certain Git repo (18)

      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

    • [Solved] oh-my-zsh slow, but only for certain Git repo (19)

      MEMark over 3 years

      FYI this also occurs on WSL on Windows with Oh My Zsh.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (20)

    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.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (21)

    VonC over 10 years

    Interesting. +1. This is more specific than my answer.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (22)

    VonC over 10 years

    Interesting feedback (more precise than my answer) +1

  • [Solved] oh-my-zsh slow, but only for certain Git repo (23)

    Jason Swett over 10 years

    And it only took me 4 months to figure out!

  • [Solved] oh-my-zsh slow, but only for certain Git repo (24)

    VonC over 10 years

    I find that fast! I know somes who take several years ;) meta.stackexchange.com/questions/36318/…

  • [Solved] oh-my-zsh slow, but only for certain Git repo (25)

    Raj over 9 years

    The compinit post improved a small amount for me, but removing parse_git_dirty really sped things up. Thanks.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (26)

    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!

  • [Solved] oh-my-zsh slow, but only for certain Git repo (27)

    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.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (28)

    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.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (29)

    Gorm Casper over 6 years

    I had to use oh-my-zsh.hide-dirty. It might have changed or maybe my theme (agnoster) only respects hide-dirty.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (30)

    Bruno Buccolo over 6 years

    Don't forget to update oh-my-zsh, otherwise your lib/git.zsh might completely ignore the hide-dirty option.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (31)

    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

  • [Solved] oh-my-zsh slow, but only for certain Git repo (32)

    chris about 5 years

    This answer added a big blank space at the end of my prompt. Not sure how to fix that.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (33)

    Steve Yang over 3 years

    What's the sdie effect?

  • [Solved] oh-my-zsh slow, but only for certain Git repo (34)

    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

  • [Solved] oh-my-zsh slow, but only for certain Git repo (35)

    Johnathan Elmore over 3 years

    git config --add oh-my-zsh.hide-dirty 1 was all I needed for my slow repo.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (36)

    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.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (37)

    stwr667 about 3 years

    @JohnathanElmore @Peeyush, DISABLE_UNTRACKED_FILES_DIRTY="true" doesn't do the same thing as the oh-my-zsh.hide-dirty setting, even though they're similar. See the code here: github.com/ohmyzsh/ohmyzsh/blob/master/lib/git.zsh#L17. The DISABLE_UNTRACKED_FILES_DIRTY setting simply adds an --untracked-files=no flag to the git status command, whereas the oh-my-zsh.hide-dirty 1 setting will skip the whole git status command altogether. I recommend @JohnathanElmore's suggestion of the global git config setting.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (38)

    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, the takashiyoshida theme works great with these flags.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (39)

    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

  • [Solved] oh-my-zsh slow, but only for certain Git repo (40)

    Harpal almost 2 years

    Updated second link

  • [Solved] oh-my-zsh slow, but only for certain Git repo (41)

    alper almost 2 years

    I observe that spacehip makes terminal slower than its already it is.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (42)

    Sinux almost 2 years

    not work for me with mac m1 on large file repository.

  • [Solved] oh-my-zsh slow, but only for certain Git repo (43)

    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

Top Articles
Latest Posts
Article information

Author: Dan Stracke

Last Updated: 08/17/2023

Views: 6428

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.