31 lines
939 B
PowerShell
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'."
|