获得最近一天的提交,并使用winscp上传到服务器

@echo off
D:devGitingit.exe pull origin master
D:devGitingit.exe add -A
D:devGitingit.exe commit -m someupdate
D:devGitingit.exe push origin master
set SESSION=sftp://user:password@ip:22
set LOCAL_PATH=D:proyourproject
set REMOTE_PATH=/public_html/
del list.txt
rem git diff --name-only HEAD~ HEAD >> list.txt 
git log --pretty=format: --name-only --since="1 days ago" >> list.txt 
echo open %SESSION% >> script.tmp
rem Generate "put" command for each line in list file
setlocal ENableDelayedExpansion
chcp 1250
for /F %%i in (list.txt) do (
set str=%%i
call set str=%%str:/=\%%
echo put "%LOCAL_PATH%!str!" "%REMOTE_PATH%%%i" >> script.tmp
)
echo exit >> script.tmp
winscp.com /script=script.tmp
set RESULT=%ERRORLEVEL%
del script.tmp
rem Propagating WinSCP exit code
exit /b %RESULT%

  

原文地址:https://www.cnblogs.com/meetrice/p/10569747.html