Skip to content

Instantly share code, notes, and snippets.

@janikvonrotz
Created April 16, 2020 18:06
Show Gist options
  • Save janikvonrotz/cb2dc91bbf8923f659d4ea148c906588 to your computer and use it in GitHub Desktop.
Save janikvonrotz/cb2dc91bbf8923f659d4ea148c906588 to your computer and use it in GitHub Desktop.
Pull all git projects
$gitUser = @(
"$Home\LocalDrive\GitHub",
"$Home\LocalDrive\GitLab",
"$Home\LocalDrive\GitHub_HaloCustomEdition",
"$Home\LocalDrive\GitHub_Hochschule-Luzern",
"$Home\LocalDrive\GitLab_Apoveda",
"$Home\LocalDrive\GitLab_Valora",
"$Home\LocalDrive\GitHub_Abilium",
"$Home\LocalDrive\GitHub_todo-md",
"$Home\LocalDrive\GitHub_Mint-System",
"$Home\LocalDrive\GitLab_Mint-System"
)
# clear screen
clear
$gitUser | ForEach-Object {
$userName = (Get-Item $_).Name
# get repos for each git user
Get-ChildItem $_ | ForEach-Object {
$repoName = $_.Name
Write-Host "Run git pull for $userName / $repoName"
cd $_.FullName
& git fetch --all
& git reset --hard origin/master
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment