git stash is slow on windows

前端 未结 2 1816
情歌与酒
情歌与酒 2020-12-08 00:33

On my windows machine git stash has about 3.5 seconds overhead on each invocation, which adds about 7 seconds to my git commit hook.

The same command un

2条回答
  •  离开以前
    2020-12-08 00:40

    git-stash is a script, not a command compiled in the git.exe binary.

    On linux : I can find git-stash at /usr/lib/git-core/git-stash - I will let you look for the correct path on windows ...


    This script uses #!/bin/sh to run, I don't know what shell implementation is used when you run this on windows.

    You can try to run it with another compatible shell (here: bash) :

    # the git-core/ dir needs to be in the PATH,
    # obviously  you will need to provide the correct path for your git-core dir
    
    $ PATH=/usr/lib/git-core:$PATH bash /usr/lib/git-core/git-stash
    

    You can also turn the -x flag, which will print a trace of all commands executed, and visually check if one of the sub commands seems to be the hanger :

    $ PATH=/usr/lib/git-core:$PATH bash -x /usr/lib/git-core/git-stash
    

提交回复
热议问题