Last active
January 23, 2019 07:10
-
-
Save sounisi5011/edd2f6b2dca0e87e3509c943d91deccf to your computer and use it in GitHub Desktop.
git pullですべてのブランチをリモートと同期するコマンド
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
# Note: リモートから削除されたブランチは自分で消す必要がある | |
# リモートブランチすべてをループ処理する | |
git fetch -p && git branch -r | while read remote; do | |
# ブランチを切り替える | |
echo "> $ git checkout ${remote#origin/}" | |
git checkout "${remote#origin/}" | |
echo | |
# ブランチをpullする | |
echo "> $ git pull origin ${remote#origin/}" | |
git pull origin "${remote#origin/}" | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment