Last active
January 22, 2024 07:18
-
-
Save anhkind/4f19428ab1dc00c98ff67f1a7c45cdda to your computer and use it in GitHub Desktop.
Select git executable in WSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from: https://github.com/microsoft/WSL/issues/4401#issuecomment-670080585 | |
# checks to see if we are in a windows or linux dir | |
function isWinDir { | |
case $PWD/ in | |
/mnt/*) return $(true);; | |
*) return $(false);; | |
esac | |
} | |
# wrap the git command to either run windows git or linux | |
function git { | |
if isWinDir | |
then | |
git.exe "$@" | |
else | |
/usr/bin/git "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment