Skip to content

Instantly share code, notes, and snippets.

@dineshkp-dev
Last active August 29, 2015 14:08
Show Gist options
  • Save dineshkp-dev/0bef31a0b6a1fb3e68da to your computer and use it in GitHub Desktop.
Save dineshkp-dev/0bef31a0b6a1fb3e68da to your computer and use it in GitHub Desktop.
Shell script to create and track all the remote branches for a Repository's clone
#!/bin/bash
for eachbranch in $(git branch -a | grep remotes | grep -v HEAD | grep -v master | awk -F/ '{print $3}');
do
git branch $eachbranch --track remotes/origin/$eachbranch;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment