Last active
March 23, 2022 14:55
-
-
Save aldegoeij/f5a375810ec7fffe0b083f2002f5ce6f to your computer and use it in GitHub Desktop.
Sync an entire GitHub org using `gh`. It clones missing repo's first, then runs a pull. Pull might fail if you have changes in your tree.
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
gh repo list $ORG_NAME_HERE --limit 1000 | while read -r repo _; do | |
gh repo clone "$repo" "$repo" -- | |
git -C "$repo" pull | |
done |
removed the --depth=1
because a shallow clone of a repo is a pain to unshallow and continue working on remote branches.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Make sure you have the GitHub cli helper
gh
installed!You can just copy the 4 lines and paste into your terminal, replacing $ORG_NAME_HERE of course with the alias of your GitHub org.