Skip to content

Instantly share code, notes, and snippets.

@anscii
Last active December 28, 2015 07:58
Show Gist options
  • Save anscii/7467721 to your computer and use it in GitHub Desktop.
Save anscii/7467721 to your computer and use it in GitHub Desktop.
Loop through git branches and pick specific string from every branch
#!/bin/bash
# list all branches
git for-each-ref --format='%(refname:short)' refs/heads |
while read branch; do
# if [[ $branch == ru_template32 ]]; then
# exit 0
# fi
echo $branch
git checkout $branch
echo $branch >> ~/dev/app_colors.txt
grep -Eo "TEAM_COLOR \[UIColor colorWithRed:\([0-9.]+\/[0-9.]+\) green:\([0-9.]+/[0-9.]+\) blue:\([0-9.]+/[0-9.]+\) alpha:1\]" ./app-ios/Customization.h >> ~/dev/app_colors.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment