Skip to content

Instantly share code, notes, and snippets.

@aldegoeij
Last active March 23, 2022 14:55
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 aldegoeij/f5a375810ec7fffe0b083f2002f5ce6f to your computer and use it in GitHub Desktop.
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.
gh repo list $ORG_NAME_HERE --limit 1000 | while read -r repo _; do
gh repo clone "$repo" "$repo" --
git -C "$repo" pull
done
@aldegoeij
Copy link
Author

aldegoeij commented Aug 31, 2021

Make sure you have the GitHub cli helper gh installed!

brew install gh

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.

@aldegoeij
Copy link
Author

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