Last active
January 18, 2022 08:15
-
-
Save fravelgue/d970597a123ff0e32ea8e5a45b422e01 to your computer and use it in GitHub Desktop.
Powershell: Doing git pull in every subdirectory
This file contains hidden or 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
$folders = Get-ChildItem -directory | |
foreach($folder in $folders) | |
{ | |
Set-Location $folder | |
if (Test-Path -Path ".git") { | |
Write-Output "git reset & pull ${folder}" | |
git checkout main | |
git reset --hard | |
git pull | |
} | |
Set-Location .. | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment