tags:

views:

604

answers:

4

I'm using git to manage files in a local directory on a windows machine - no network is involved here, I'm not pushing or pulling to/from another machine. My directory has maybe 100 files in it, all test files, pretty small. When I run "git status", it regularly takes 20-30 seconds to complete. Is this normal? Is there anything I can do to speed it up, or a better way to see what the state of my repository is (changed files, untracked files, etc)? Other git commands seem to complete much faster.

+3  A: 

Have you tried repacking? git-repack.

Otherwise, try duplicating the directory, and deleting the .git folder in the duplicated directory. Then create a new git directory and see if it's still slow.

If it's still slow, then it sounds like a system or hardware issue. Git finishes status on hundreds of files for me in less than 5 seconds.

thedz
repack seemed to help - after running it, I ran status, and it returned immediately. However, I waited a few seconds and ran status again, and it took 30 seconds. I tried duplicating the directory, and got the same problem.
Matt McMinn
Hmm, interesting. Do you have an external drive? Or a USB flash stick? Try copying the repo over there and see if there's any difference. It's possible there's an issue with the drive it's currently on.
thedz
No difference on a USB drive.
Matt McMinn
That's really strange. All I can really say at this point is that I don't know. You could try copying your repo and try it on someone else's computer -- that should, at least, tell you if it's a problem local to your system.
thedz
+1  A: 

Are you using some kind of virus protection software? Maybe that is interfering with things. git is very fast for me on windows with repositories of 1000's of files.

1800 INFORMATION
Yes, employer mandated TrendMicro OfficeScan. I killed the virus scanner, same results with git status.
Matt McMinn
Another variant on this theme is on-the-fly encryption software such as Credant, which can make your box remarkably slower.
Don Branson
+5  A: 

Have you tried git gc? This cleans cruft out of the git repo.

Scott
This seems to have done the trick. I'm very surprised though that after only a couple of commits that the repository would have that much stuff that can be cleaned up - thanks!
Matt McMinn
A: 

Try starting with a fresh clone of your checkout.

git clone myrepo mynewrepo

and then do git status in mynewrepo.

Alternatively, and if you are braver, clean out the rubbish from your existing checkout.

git clean -dfx

This avoids git having to scan some (possibly large) set of ignored or not checked-in files.

Alex Brown