Skip to content

Instantly share code, notes, and snippets.

@fravelgue
Last active January 18, 2022 08:15
Show Gist options
  • Save fravelgue/d970597a123ff0e32ea8e5a45b422e01 to your computer and use it in GitHub Desktop.
Save fravelgue/d970597a123ff0e32ea8e5a45b422e01 to your computer and use it in GitHub Desktop.
Powershell: Doing git pull in every subdirectory
$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