Last active
August 29, 2015 14:14
-
-
Save ufcpp/39ee4a872384f1f2aa35 to your computer and use it in GitHub Desktop.
複数のgitリポジトリの一斉更新(upstream → origin)
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
git config --global alias.u2m '!git fetch upstream; git push origin upstream/master:master -f;' |
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
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 | |
} | |
} |
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
("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