Skip to content

Instantly share code, notes, and snippets.

@anhkind
Last active January 22, 2024 07:18
Show Gist options
  • Save anhkind/4f19428ab1dc00c98ff67f1a7c45cdda to your computer and use it in GitHub Desktop.
Save anhkind/4f19428ab1dc00c98ff67f1a7c45cdda to your computer and use it in GitHub Desktop.
Select git executable in WSL
# 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