bat批量更新推送及标签本地Git仓库

更新

@echo off
:: 当前目录
set curdir=%cd%
:: 输出当前目录中的子目录名字不带路径
for /f %%i in ('dir /b /ad "%curdir%"') do (
	cd  %%i
	IF EXIST .git (
		echo %%i
		git pull
		echo.
	)
	cd ..
)
msg %username% /time:10 'git pull success'

bat批量更新推送及标签本地Git仓库_第1张图片

推送

@echo off
:: 当前目录
set curdir=%cd%
:: 输出当前目录中的子目录名字不带路径
:: 若是 多个目录,可将curdir修改为目录名,以空格分割
for /f %%i in ('dir /b /ad "%curdir%"') do (
	cd  %%i
	IF EXIST .git (
		echo %%i
		git push
		echo.
	)
	cd ..
)
pause

创建标签并推送

@echo off
:: 当前目录
set curdir=%cd%
::ECHO 取年份: %date:~0,4% 
::ECHO 取月份 %date:~5,2% 
::ECHO 取日期:%date:~8,2% 
::ECHO 取星期:%date:~10,6% 
::ECHO 取小时:%time:~0,2% 
::ECHO 取分:%time:~3,2% 
::ECHO 取秒:%time:~6,2% 
set dd=%DATE:~8,2%
set mm=%DATE:~5,2%
set yy=%DATE:~0,4%
set Tss=%TIME:~6,2%
set Tmm=%TIME:~3,2%
set Thh=%TIME:~0,2%
set Thh=%Thh: =0%

set this_date=%yy%%mm%%dd%-%Thh%%Tmm%%Tss%
ECHO %this_date%
echo.
set tag_name=%this_date%.RELEASE
ECHO %tag_name%
echo.
:: 输出当前目录中的子目录名字不带路径
for /f %%i in ('dir /b /ad health-*') do (
	cd  %%i
	IF EXIST .git (
		echo %%i
		echo 'create tag' %tag_name%
		git tag -a %tag_name%  -m "%tag_name%"
		git push --tags
		echo.
	)
	cd ..
)
pause

你可能感兴趣的:(windows,git,github)