Recently I've been using git stash many times and I've been thinking that it is really slow, even on a new repository with a single file. I've read this question about git stash slowness and this other one and tried every answer to these questions but nothing actually works.
For example I've done the following steps to reproduce it:
git init
touch file.txt
vim file.txt
(edit the file adding 2 lines)git add .
git commit -m "Initial commit"
vim file.txt
(edit it again adding 1 line)time git stash
Output:
$ time git stash
Saved working directory and index state WIP on master: b9454ed Initial commit
HEAD is now at b9454ed Initial commit
real 0m8.042s
user 0m0.000s
sys 0m0.046s
8 seconds for stashing a single line is so much time. Now a test using libgit2sharp:
static void Main(string[] args)
{
Repository repo=new Repository(@"C:\Users\UserTest\TestGitRepo");
repo.Stashes.Add(new Signature("test", "[email protected]", new DateTimeOffset(DateTime.Now)), "Stash on master");
}
This code takes 74ms to stash the same change.
If Libgit2 is that fast then it should be possible to speed up git stash
command. How can I achieve this?
Actually using windows 10 64bit and git 2.11 64bits. Other git commands (like status, add, commit, etc.) work fine.
UPDATE: I've updated to git 2.13 and now it's 14,53s for git stash
...
UPDATE 2: I've updated to git 2.15 and trying the same test time git stash
returns real 0m6,553s
. Still really slow...
sh.exe.stackdump
is created, can you verify thatgit stash
actually did what it was supposed to do? – Commune