Skip to content

Instantly share code, notes, and snippets.

@pexcn
Last active May 25, 2021 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pexcn/a0155c762e6026ea1d52c15e9b81b05d to your computer and use it in GitHub Desktop.
Save pexcn/a0155c762e6026ea1d52c15e9b81b05d to your computer and use it in GitHub Desktop.
Use msys2 git on vscode
@echo off
setlocal
rem https://github.com/eamodio/vscode-gitlens/issues/965#issuecomment-734013893
set PATH=%~dp0usr\bin;%PATH%
:loop
if "%~1" equ "rev-parse" goto rev_parse
shift
if not "%~1"=="" goto loop
git.exe %*
goto :eof
:rev_parse
git.exe %* | cygpath -w -f -
@echo off
setlocal
rem https://github.com/microsoft/vscode/issues/4651
set PATH=%~dp0usr\bin;%PATH%
if "%1" equ "rev-parse" goto rev_parse
git %*
goto :eof
:rev_parse
for /f %%1 in ('git %*') do cygpath -w %%1
@pexcn
Copy link
Author

pexcn commented May 25, 2021

TODO: git.exe -> git?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment