Skip to content

Instantly share code, notes, and snippets.

@mfojtik
Created February 21, 2014 10:50
Show Gist options
  • Save mfojtik/9132356 to your computer and use it in GitHub Desktop.
Save mfojtik/9132356 to your computer and use it in GitHub Desktop.
devenv-sync
#!/bin/bash
bold=`tput bold`
normal=`tput sgr0`
devenv() {
pushd /home/mfojtik/code/rh/li &>/dev/null
./build/devenv "$@"
popd &> /dev/null
}
pushd $HOME/code/rh >/dev/null
for sync_dir in {origin-server,li,origin-dev-tools}; do
pushd $HOME/code/rh/$sync_dir >/dev/null
current_branch=`git rev-parse --abbrev-ref HEAD`
if [ "$current_branch" != "master" ]; then
echo -ne "[${sync_dir}@${bold}${current_branch}${normal}] Switch back to 'master' (y/N) ?"
read answer
if [ "$answer" == "y" ]; then
git checkout master
if [ "$?" != "0" ]; then
echo "ERROR: Cannot switch to master, please fix this manually."
exit 1
fi
fi
fi
popd >/dev/null
done
echo "Syncing repositories..."
devenv sync verifier
popd >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment