Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephenharris/70961438a34cf7a66a5d to your computer and use it in GitHub Desktop.
Save stephenharris/70961438a34cf7a66a5d to your computer and use it in GitHub Desktop.
A oneline script to create tracking branches for all remote branches
# A oneline script to create tracking branches for all remote branches
# @see http://stackoverflow.com/a/4754797/932391
#
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