mariachimike mariachimike - 9 months ago 66
Bash Question

How do I write a batch file which opens the GitBash shell and runs a command in the shell?

I'm on Windows 7 trying to use a batch file to open the GitBash shell and make a git call.
This is the contents of my batch file:

REM Open GitBash
C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
REM retrieve archive
git archive master | tar -x -C %~1
REM quit GitBash

I noticed that the GitBash is logging out before the next command "git archive...". Does anybody know if I can pass the command into GitBash and how?


"C:\Program Files (x86)\Git\bin\sh.exe" --login -i -c "git archive master | tar -x -C $0" "%~1"