Created
September 25, 2012 22:40
-
-
Save SirkleZero/3784905 to your computer and use it in GitHub Desktop.
This powershell script will enumerate the Git projects in a parent directory, perform a fetch on each remote and then print out the status of the repo.
This file contains 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
$global:GitAllSettings = New-Object PSObject -Property @{ | |
FolderForegroundColor = [ConsoleColor]::Cyan | |
} | |
function git-all() | |
{ | |
$s = $global:GitAllSettings | |
dir -r -i .git -fo | % { | |
pushd $_.fullname | |
cd .. | |
write-host -fore $s.FolderForegroundColor (get-location).Path | |
git-fetchall | |
popd | |
} | |
} | |
function git-fetchall() | |
{ | |
$remotes = git remote | |
if($remotes){ | |
$remotes | foreach { | |
Write-Host 'Fetching from' $_ | |
git fetch $_ | |
} | |
}else{ | |
Write-Host 'No remotes for this repository' | |
} | |
git status | |
} | |
[System.Reflection.Assembly]::LoadWithPartialName("System.Diagnostics") | |
$sw = new-object system.diagnostics.stopwatch | |
$sw.Start() | |
git-all | |
$sw.Stop() | |
Write-Host "Completed in " $sw.Elapsed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment