Skip to content

Instantly share code, notes, and snippets.

@ufcpp
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ufcpp/39ee4a872384f1f2aa35 to your computer and use it in GitHub Desktop.
Save ufcpp/39ee4a872384f1f2aa35 to your computer and use it in GitHub Desktop.
複数のgitリポジトリの一斉更新(upstream → origin)
git config --global alias.u2m '!git fetch upstream; git push origin upstream/master:master -f;'
param([switch]$reset)
process
{
$folder = $_
pushd $folder
try
{
$log = git u2m 2>&1
$firstLine = [string]$log[0]
if ($firstLine -match 'Everything up-to-date')
{
$folder + ' up-to-date'
}
else
{
Write-Host ($folder + " updated") -ForegroundColor Yellow
}
if ($reset)
{
[void](git checkout master 2>&1)
[void](git rh 2>&1)
}
}
finally
{
popd
}
}
("repository A", "repository B") | | . ./git-u2m.ps1
("repository C", "repository D") | | . ./git-u2m.ps1 -reset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment