Skip to content

Instantly share code, notes, and snippets.

@Leask
Created December 18, 2013 19:42
Show Gist options
  • Select an option

  • Save Leask/8028547 to your computer and use it in GitHub Desktop.

Select an option

Save Leask/8028547 to your computer and use it in GitHub Desktop.
How do I clone all remote branches with Git?
#!/bin/bash
# http://stackoverflow.com/questions/67699/how-do-i-clone-all-remote-branches-with-git?rq=1
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v 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