Skip to content

Instantly share code, notes, and snippets.

@wilmarvh
Created April 22, 2019 20:11
Show Gist options
  • Star 36 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save wilmarvh/95fe7daed6ee6a63d811677e040ae421 to your computer and use it in GitHub Desktop.
Save wilmarvh/95fe7daed6ee6a63d811677e040ae421 to your computer and use it in GitHub Desktop.
git checkout-all-branches
#!/bin/bash
#Whenever you clone a repo, you do not clone all of its branches by default.
#If you wish to do so, use the following script:
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master `; do
git branch --track ${branch#remotes/origin/} $branch
done
@bonellimitch
Copy link

Nice!! Works like a charm!

@VM-COD
Copy link

VM-COD commented Oct 14, 2022

Awesome!! Thanks a lot

@MaciekWiniarski
Copy link

You made my day. Thanks a lot!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment