Files
DocumentServer-v-9.2.0/convert_submodules.ps1
Yajbir Singh f1b860b25c
Some checks failed
check / markdownlint (push) Has been cancelled
check / spellchecker (push) Has been cancelled
updated
2025-12-11 19:03:17 +05:30

31 lines
939 B
PowerShell

$gitmodules = Get-Content .gitmodules
$paths = $gitmodules | Select-String "path = (.*)" | ForEach-Object { $_.Matches.Groups[1].Value.Trim() }
foreach ($path in $paths) {
Write-Host "Processing submodule: $path"
# Check if path exists
if (Test-Path $path) {
# Remove from git index
Write-Host " Removing from git index..."
git rm --cached $path
# Remove .git directory inside the submodule
$gitDir = Join-Path $path ".git"
if (Test-Path $gitDir) {
Write-Host " Removing .git directory..."
Remove-Item -Path $gitDir -Recurse -Force
}
} else {
Write-Host " Path $path does not exist, skipping..."
}
}
# Remove .gitmodules file
if (Test-Path .gitmodules) {
Write-Host "Removing .gitmodules file..."
git rm .gitmodules
}
Write-Host "All submodules converted. You can now run 'git add .' and 'git commit'."