Skip to content

Instantly share code, notes, and snippets.

@dharma017
Last active October 15, 2015 09:55
Show Gist options
  • Select an option

  • Save dharma017/6d299e4dcb9bb9d6d0e6 to your computer and use it in GitHub Desktop.

Select an option

Save dharma017/6d299e4dcb9bb9d6d0e6 to your computer and use it in GitHub Desktop.
Clone all remote branches with Git - one liner bash command
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment