61

I work on a lot of small projects on daily basis and need to switch often.

  • I have over 50 Git Repositories in Sourcetree.
  • Usually 5 projects are open in "Tabs".

Switching from "Tab" in SourceTree is very slow. Sometimes up to 15 seconds. How can I improve this behaviour?

enter image description here

Pang
  • 9,564
  • 146
  • 81
  • 122
Dimitri Dewaele
  • 10,311
  • 21
  • 80
  • 127

12 Answers12

68

I know this is an old question, but you could also try this:

https://stackoverflow.com/a/24045966/371917

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

Secondly, here is a post that explains that git gc --aggressive may not be a great idea.

Community
  • 1
  • 1
Peet Brits
  • 2,911
  • 1
  • 31
  • 47
21

Executing the stated git command did not do the trick for me. Eventually what really speed up SourceTree was disabling 'spell check commit messages' in the tools > options menu. I also disabled 'load avatar images from gravatar.com' option while I was at it.

Bas Slagter
  • 9,831
  • 7
  • 47
  • 78
  • 5
    The performance when switching projects decreased mysteriously one day (without any change in the loaded repositories). Disabling the spell check fixed it for me. Thanks for the hint! – kaape Aug 17 '16 at 08:13
  • 1
    Disabling gravatar did it! Wow. Big difference. – Scott Duffy Oct 10 '17 at 19:29
12

Any action in my source tree was super slow. Commit, click on a file to see changes, push etc.

I discovered that my antivirus (avast) was the cause. I disabled the file protection and source tree became immediate.

Emir Lima
  • 221
  • 2
  • 6
  • I discovered it went so much faster with Avast enabled, but wasn't sure why. Thought maybe it was the firewall, but added an exclusion for file protection to my working folders and SourceTree is responsive again. And as a bonus my local webhost environment is fast again too! – helgatheviking Jan 15 '16 at 20:28
  • 1
    wow, this is even the same for Mac. I downloaded `bitdefender` for the shake of testing antivirus on Mac and my ST became super slow. Thank a ton !!! – Thai Tran Feb 15 '16 at 02:56
  • I had the same problem, SourceTree was being that slow that was impossible to use. It started after I updated to Windows 10, I noticed everything involving the file system was really slow (specially my second hard drive). I was blaming Windows at the beginning but It seems Avast and its "file system shield" was provoking that. I disabled it and everything works well again! – Pau Guillamon Aug 13 '16 at 23:57
  • 1
    windows defender is among the culprits – Pica Jan 22 '17 at 23:48
  • You are right Emir, you saved me so much time! Thank you! It was Avast causing this problem (e.g. I was waiting for 5 mniutes to pull the code from repository). I disabled "file system shield" (Štít souborového systému) and there is no prbolem with sourcetree anymore. – exoslav Mar 29 '17 at 21:25
10

I had this problem too. I also have avast and this worked for me and might work for you and maybe a different AV. But I added the C:\Users\YOURNAME\AppData\Local\Atlassian\ to my avast exclusions directory and now it is running much faster!

7

For me it was the 'spell check commit messages' option in the settings. Even clicking the tick took 20 sec to process, but it was the last freezing I experienced.

Sergey Gussak
  • 142
  • 1
  • 8
  • 1
    +1 super random, but I've been having issues since a few builds ago even with just a few repos and this has completely fixed it for me. – Matt Brunmeier Sep 30 '16 at 17:46
6

The source tree ticket system has a ticket about a similar bug that was fixed. http://www.lifehacker.com.au/2015/01/6-month-old-critical-performance-bug-with-sourcetree-is-getting-attention/

I never used so many repos at once and assume that sourcetree is not build to handle this amount of data on every time you switch tabs. I assume sourcetree need to refresh the data and reads and build your data out of the disk page file.

Try to use fewer projects and see it you still have the same problem.

If you still experience lack of performance try to run gc (garbage collector) on your repos and test it again.

git gc --aggressive shrinks the repository size.

Dimitri Dewaele
  • 10,311
  • 21
  • 80
  • 127
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
4

Improved performance with

  1. Install latest git exe from https://git-scm.com/download/win
  2. Configured Options > Git > Use System Git instead Use Embedded Git
Jignesh Variya
  • 1,869
  • 16
  • 12
  • I already used systems git, but updating from 2.13.2 to 2.20.1 helped. Now SourceTree is a LOT faster than before, where I need to wait several seconds to detect a few changed line on a single file. Can't explain why cause only 3 repos were open and the one I'm currently open is small. – Lion Dec 26 '18 at 22:12
2

This may help someone else. I was having slow response issues with SourceTree 1.6.x and git 1.9.x. Downgrading git to 1.8.3 and SourceTree to 1.5.2 solved the problem.

Fabiano Araujo
  • 876
  • 6
  • 19
  • The link for 1.5.2: http://downloads.atlassian.com/software/sourcetree/windows/SourceTreeSetup_1.5.2.exe – Peet Brits Jul 30 '15 at 08:28
  • I wrote a long blog post about downgrading, but keeping the embedded git/hg up to date (old git/hg had serious security issues): http://wiert.me/2015/01/15/downgrading-to-sourcetree-1-5-x-from-1-6-x-but-keeping-up-with-the-youngest-embedded-git-and-mercurial/ – Jeroen Wiert Pluimers Aug 17 '15 at 19:19
  • Eventually I ended up changing the software to TortoiseGit. SourceTree didn't offer any solution for the slowness. – Fabiano Araujo Aug 21 '15 at 22:53
1
  1. Move the git folder to an SSD drive, if possible (dramatically improved my SourceTree performance).

  2. Avoid having a lot of stashes, which REALLY slows down SourceTree.

brkeyal
  • 1,317
  • 1
  • 16
  • 22
1

Latest version currently 2.1.2.5 released June 2017 was running dog slow for me even after trying all the answers here prior to today (even with just 1 project).

Apparently, .gitconfig was written to a network drive (H:) when SourceTree was first installed. This is what got the performance to instantaneous for me:

  1. Move .gitconfig to local SSD (C:)

  2. Set HOME variable. In Environment Variables (specifically User variable), set HOME to the value of C: (or whatever other path you decide to set).

Pang
  • 9,564
  • 146
  • 81
  • 122
Vik
  • 395
  • 2
  • 4
  • 8
1

TL;DR:

Option 1: (Keep using SourceTree): SourceTree does long thorough refresh. Can be turned off by setting filter to "Modified". (For me I had to set it back and forth once to take effect).

enter image description here

Option 2: (Use Tower/CLI and set showUntrackedFiles)

Option 3: (Use Tower/CLI and With Scalar).

Microsoft has a solution for improving repo performance: Scalar

Long Version: Had this issue with large repository (has many files). Investigated and found root cause of SourceTree slowness.

You can test issue in command line:

git status -uall 

vs

git status -uno

If you find git status -uall is super slow (same slowness as SourceTree then this is likely your culprit).

Sourcetree always uses -uall when doing status refreshes.

There is a way to configure your git config file to always skip searching for untracked files when running git status via:

git config --local status.showUntrackedFiles no

The problem then becomes SourceTree refuses to respect this flag (while other tools like Tower do respect it).

More info can be found here (under status.showUntrackedFiles section): https://git-scm.com/docs/git-config

And here (under --untracked-files[=<mode>] section): https://git-scm.com/docs/git-status

NOTE: Setting showUntrackedFiles property to no on your repo's git config file will mean when you add a new file it won't be picked up by git status unless you explicitly run it with -uall param.

Vlad
  • 5,727
  • 3
  • 38
  • 59
0

For me the issue was that I had way to many untracked files. Modified my .gitignore and SourceTree stoped being slow

Rickard
  • 678
  • 5
  • 14