Reputation: 364
Is there a way to get the path of a local repository from git that can be executed from a batch file?
set GITBIN="c:\Program Files (x86)\Git\bin"
set REPODIR1=C:\RandomPath1\REPOSITORY1
set REPODIR2=C:\RandomPath2\REPOSITORY2
pushd %TGACOREDIR%
@echo on
%GITBIN%\git pull
@if %ERRORLEVEL% NEQ 0 (
goto :pullerror
)
I'd like to get REPODIR1 and REPODIR2 from git, so that developers can run the script, even if they have their local repositories in different locations from one another. Is there a way to do it so that REPODIR1 and REPODIR2 don't have to be hardcoded in this .bat file?
Upvotes: 0
Views: 591
Reputation: 14843
This command should do what you want
git rev-parse --show-toplevel
Upvotes: 1