Skip to content

Instantly share code, notes, and snippets.

@doulmi
Created June 23, 2017 14:16
Show Gist options
  • Star 16 You must be signed in to star a gist
  • Fork 13 You must be signed in to fork a gist
  • Save doulmi/c4000ce1adbfb8fa270bd67b8bda0976 to your computer and use it in GitHub Desktop.
Save doulmi/c4000ce1adbfb8fa270bd67b8bda0976 to your computer and use it in GitHub Desktop.
Download All branches
#!/bin/bash
set -x #echo on
remote_url=$(git config --get remote.origin.url)
for branch in $(git branch --all | grep '^\s*remotes' | egrep --invert-match '(:?HEAD|master)$'); do
branch_name=$(echo $branch| cut -d'/' -f 3)
git clone -b $branch_name $remote_url $branch_name
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment