Skip to content

Instantly share code, notes, and snippets.

@mnadjit
Last active June 18, 2023 13:10
Show Gist options
  • Save mnadjit/277ddd5fd6b7cade9d1f27e2708be473 to your computer and use it in GitHub Desktop.
Save mnadjit/277ddd5fd6b7cade9d1f27e2708be473 to your computer and use it in GitHub Desktop.
PowerShell scripts to upload or download contents of the directory passed as argument to/from origin
$script:cur_dir = (Get-Location)
$script:args | % {
Set-Location $_
Write-Output "`nDownloading from origin into path: $($_)`n"
git fetch --all
git reset --hard origin/main
git pull --force
}
Set-Location $cur_dir
$script:cur_dir = (Get-Location)
$script:args | % {
Set-Location $_
Write-Output "`nUploading to origin from path: $($_)`n"
git add --all
git commit -am "updated"
git push --all --force
}
Set-Location $cur_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment