Skip to content

Instantly share code, notes, and snippets.

@larsvilhuber
Created August 5, 2019 18:57
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 larsvilhuber/c9e062121864784fd3f6de84bb84f952 to your computer and use it in GitHub Desktop.
Save larsvilhuber/c9e062121864784fd3f6de84bb84f952 to your computer and use it in GitHub Desktop.
git setup all remote branches
#!/bin/bash
# Credit:
# https://stackoverflow.com/questions/67699/how-to-clone-all-remote-branches-in-git
for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do
git branch --track "${branch##*/}" "$branch"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment