Created
April 5, 2024 04:02
-
-
Save DineshSolanki/01a4a778bd4b1a9665a8389f8b9294bc to your computer and use it in GitHub Desktop.
Get remote links of a multi-repo folder
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 | |
cd /D "C:\Projects\multi-repo" | |
REM Create a new CSV file or clear the existing one: | |
echo. > repos.csv | |
REM Loop over each subfolder (each individual repository) | |
for /D %%d in (*) do ( | |
cd %%d | |
REM Check if .git directory exists | |
if exist .git ( | |
set "remote=" | |
for /F "tokens=2" %%r in ('git remote -v ^| find "fetch"') do ( | |
set "remote=%%r" | |
) | |
if defined remote ( | |
echo %%d,!remote! >> ..\repos.csv | |
) | |
) | |
cd .. | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment