Files
sysconfig/git_rename_branch.bat
luk 9742f6dab2 refactor: 脚本及配置文件命名统一用 _ 分隔
将 .sh/.bat 脚本与 .js/.plist/.Dockerfile 等文件中以 - 分隔的文件名
改为 _ 分隔,dcloud-renew 目录改为 dcloud、script_nuance 目录改为
nuance,并同步更新脚本内部引用与 README 路径。

Co-Authored-By: AtomCode (deepseek-v4-flash) <noreply@atomgit.com>
2026-08-25 15:11:50 +08:00

61 lines
1.5 KiB
Batchfile
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
@REM 首先清除可能残留的变量
set ROOTPATH=
@ if not "" == "%1" (
set ROOTPATH=%1
) else (
echo;
echo ::*** Enter [root path]> or [leave blank] for default to [[%CD%]]
set /p ROOTPATH=">>> "
echo;
if "" == "%ROOTPATH%" (
set ROOTPATH=%CD%
)
)
if not exist %ROOTPATH% (
echo ××× [[%ROOTPATH%]] not exist! Exit now. ***
@ GOTO END
) else (
echo √√√ ROOTPATH = [[%ROOTPATH%]]
)
pushd %ROOTPATH%
echo ::*** Current path = [[%CD%]]
@REM for /d %%d in (*) do ( pushd %%d & ( for /d %%d in (*) do ( if exist %%d/.git pushd %%d & echo --- git pulling: %%d ... & git pull & popd ) ) & popd )
for /d %%o in (*) do (
@REM windows的链接文件会造成路径错误从而终止该循环从而导致下一轮乃至所有循环的工作目录错误。因此要过滤掉 .vscode 这个符号链接目录。
if not %%o == .vscode (
echo entering [[%ROOTPATH%\%%o]]
pushd %%o
for /d %%g in (*) do (
if exist %%g\.git (
pushd %%g
@REM echo changing repo url
@REM git remote remove origin
@REM git remote add origin https://git.tic.cc/%%o/%%g
@REM git pull
@REM git branch --set-upstream-to=origin/main main
@REM git pull
echo changing branch name
git branch -m master main
git push -u origin main
git push origin :master
popd
)
)
popd
)
)
popd
:END
pause