strolch/li.strolch.dev/pull.sh

27 lines
559 B
Bash
Raw Normal View History

#!/bin/bash
2014-09-22 09:30:42 +02:00
function fail() {
echo -e "\nERROR: Failed to pull from upstream"
exit 1
}
2014-09-22 09:30:42 +02:00
current_branch="$(git branch --quiet | grep "*" | cut -d ' ' -f 2)"
if [ "${current_branch}" == "" ] ; then
echo -e "\nERROR: No local branch found!"
fail
fi
2014-09-22 09:30:42 +02:00
cd ..
2014-09-22 09:30:42 +02:00
echo "INFO: Pulling Strolch..."
if ! git pull origin "${current_branch}:${current_branch}" ; then
fail
fi
echo "INFO: Pulling submodules..."
if ! git submodule foreach git pull origin "${current_branch}:${current_branch}" ; then
fail
fi
2014-09-22 09:30:42 +02:00
echo -e "\nINFO: Pulled all Strolch projects."
exit 0