strolch/li.strolch.dev/push.sh

27 lines
557 B
Bash
Raw Normal View History

2013-10-27 03:49:34 +01:00
#!/bin/bash
2014-09-22 09:30:42 +02:00
function fail() {
echo -e "\nERROR: Failed to push to 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: Pushing Strolch..."
if ! git push origin "${current_branch}:${current_branch}" ; then
fail
fi
echo "INFO: Pushing submodules..."
if ! git submodule foreach git push origin "${current_branch}:${current_branch}" ; then
fail
fi
2013-10-27 03:49:34 +01:00
2014-09-22 09:30:42 +02:00
echo -e "\nINFO: Pushed all Strolch projects."
exit 0