GIT_WINDOWS="/mnt/c/Program Files/Git/bin/git.exe"
GIT_LINUX="/usr/bin/git"
case "$(pwd -P)" in
/mnt/?/*)
case "$@" in
# Needed to fix prompt, but it breaks things like paging, colours, etc
rev-parse*)
# running linux git for rev-parse seems faster, even without translating paths
exec "$GIT_LINUX" "$@"
;;
*)
exec "$GIT_WINDOWS" -c color.ui=always "$@"
;;
esac
;;
*)
exec "$GIT_LINUX" "$@"
;;
esac
This allows you to use `git` in your WSL shell but it'll pick whichever executable is suitable for the filesystem that the repo is in :)
An offline cheat sheet of those git commands comes in hand occasionally, too.