Last active
April 5, 2024 04:23
-
-
Save DineshSolanki/07277c5546e6544f70f7f7b94018562d to your computer and use it in GitHub Desktop.
Change remote based on file generated from getRemote.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal EnableDelayedExpansion | |
REM Define your multi-repo folder path here: | |
set "multiRepoDir=path\to\your\multi-repo\folder" | |
cd /D "%multiRepoDir%" | |
REM Get the script directory | |
set "scriptDir=%~dp0" | |
REM Loop over each line in CSV file | |
for /F "tokens=1,2 delims=," %%a in ('type "%scriptDir%repos.csv"') do ( | |
REM If the directory exists and is a git repo | |
if exist "%%a\.git" ( | |
REM Change into the directory | |
cd "%%a" | |
REM Change the 'origin' remote to the URL from the CSV file | |
git remote set-url origin %%b | |
REM Change back to the root directory | |
cd /D "%multiRepoDir%" | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment