Skip to content

Instantly share code, notes, and snippets.

@ferstar
Created June 3, 2015 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ferstar/b3fe90cebf939e4fb903 to your computer and use it in GitHub Desktop.
Save ferstar/b3fe90cebf939e4fb903 to your computer and use it in GitHub Desktop.
Clone all remote branches with Git
#!/bin/bash
# from http://stackoverflow.com/questions/67699/clone-all-remote-branches-with-git
# usage: sh -x pull_all.sh
# 在你的git目录下执行此脚本即可
for branch in `git branch -a | grep remotes | grep -v HEAD | grep -v master`; do
git branch --track ${branch##*/} $branch
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment