Skip to content

Instantly share code, notes, and snippets.

@kostandy
Created October 7, 2019 09:12
Show Gist options
  • Save kostandy/42d6f96ca511a0178b9487d7050af794 to your computer and use it in GitHub Desktop.
Save kostandy/42d6f96ca511a0178b9487d7050af794 to your computer and use it in GitHub Desktop.
Checkout all branches from Git repo
#!/bin/bash
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