Skip to content

Instantly share code, notes, and snippets.

@dhoko
Created December 2, 2020 15:02
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 dhoko/530112ebb509dc68c1eb3739e6104a2f to your computer and use it in GitHub Desktop.
Save dhoko/530112ebb509dc68c1eb3739e6104a2f to your computer and use it in GitHub Desktop.
Create a local copy of all remote branches for a repository
git ls-remote --heads | awk -F '/' '{ print $NF }' | while read -r name; do
echo "[${name}]";
git fetch origin "${name}:${name}";
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment