Skip to content

Instantly share code, notes, and snippets.

@todoshcenko
Last active July 5, 2017 14:01
Show Gist options
  • Save todoshcenko/e9e00993d3953bab79b6b7e69020958e to your computer and use it in GitHub Desktop.
Save todoshcenko/e9e00993d3953bab79b6b7e69020958e to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
branch=$1
dependenciesDir=$2
for libDir in ${dependenciesDir}/*/ ; do
pushd ${libDir} > /dev/null
for remoteBranch in $(git ls-remote --heads origin | sed -r 's/\w+\s+//'); do
if [ "${remoteBranch}" == "refs/heads/${branch}" ]; then
git fetch -q origin ${branch}:${branch}
git checkout -q ${branch}
echo $(basename ${libDir})
fi
done
popd > /dev/null
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment