Skip to content

Instantly share code, notes, and snippets.

@DineshSolanki
Created April 5, 2024 04:02
Show Gist options
  • Save DineshSolanki/01a4a778bd4b1a9665a8389f8b9294bc to your computer and use it in GitHub Desktop.
Save DineshSolanki/01a4a778bd4b1a9665a8389f8b9294bc to your computer and use it in GitHub Desktop.
Get remote links of a multi-repo folder
@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