Skip to content

Instantly share code, notes, and snippets.

@7rin0
Created February 20, 2017 21:40
Show Gist options
  • Save 7rin0/ffe348b99d0032e84b1a6a30275aa6d0 to your computer and use it in GitHub Desktop.
Save 7rin0/ffe348b99d0032e84b1a6a30275aa6d0 to your computer and use it in GitHub Desktop.
Bypass some limitations on getting origin HEAD by parsing each branch individually.
#!/bin/bash
# Bypass some limitations on getting origin HEAD
# by parsing each branch individually.
# Get all origin branchs
ORIGINS=$(git ls-remote --heads origin | tr '\/' ' ' | tr -s ' ' | cut -d' ' -f3)
for branch in $ORIGINS
do
git fetch origin $branch -p
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment