Skip to content

Instantly share code, notes, and snippets.

@rkalit
Created October 13, 2021 09:30
Show Gist options
  • Select an option

  • Save rkalit/11c4d4f9a1d22ea232e06c0594f7e5bd to your computer and use it in GitHub Desktop.

Select an option

Save rkalit/11c4d4f9a1d22ea232e06c0594f7e5bd to your computer and use it in GitHub Desktop.
A script to get all remote branch to your local, put this script on your `/usr/local/bin`
#!/bin/bash
workdir=$(pwd)
tempFile=$HOME/temp.txt
cd ${workdir}
git branch -a | grep 'origin' | grep -v 'HEAD' | cut -d "/" -f3 -f4 > ${tempFile}
for branch in `cat ${tempFile}`;
do
git checkout ${branch}
git pull origin ${branch}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment