Improve the performance of git on WSL2

I've returned to Windows after a year on the Mac. I built up pwsh and added a lot of tools, but I still need some Linux/MacOS ones, such as envsubst. Of course, WSL2 comes to the rescue, but you'll have to checkout the repo twice for Linux and Visual Studio. It is ridiculous.
I set up oh-my-posh with powerline on WSL2, which is a fantastic combination. However, there is a "but": git status is quite slow. What is the reason for this? Just read 4197

How can this be resolved? Simply replace the git command with the git function, as shown below:

function git() {  
  if [[ $(pwd -P) = /mnt/* ]]; then
    git.exe "[email protected]"
  else
    command git "[email protected]"
  fi
}

And that's all 🙈🙉🙊