Skip to content

Instantly share code, notes, and snippets.

@squatto
Forked from doulmi/download_all_branches.sh
Created June 10, 2018 16:31
Show Gist options
  • Save squatto/1591bdffd49a47c85fb94b84a8a3f04e to your computer and use it in GitHub Desktop.
Save squatto/1591bdffd49a47c85fb94b84a8a3f04e 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