-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcm
executable file
·25 lines (22 loc) · 1023 Bytes
/
gcm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
git status | grep "On branch master" &>/dev/null
if [ "$?" -eq "0" ]; then
echo -e "\e[00;31mAlready on master.\e[00m";
exit 1;
fi;
git status | grep "nothing to commit" &>/dev/null
if [ "$?" -ne "0" ]; then
echo -e "\e[1;33;31mWorking directory is dirty. Save or stash your changes.\e[00m";
git status
exit 1;
fi
echo -e "Checking out \e[00;32mmaster\e[00m...";
set -e
git fetch || ( echo "Error while fetching." && exit 1 )
git checkout master || ( echo "Error while checking out master." && exit 1 )
git merge origin/master || ( echo "Error while fast forwarding master." && exit 1 )
git submodule init || ( echo "Error while initializing submodules." && exit 1 )
git submodule sync || ( echo "Error while syncing submodules." && exit 1 )
git submodule update --recursive || ( echo "Error while updating submodules." && exit 1 )
git clean -fd || ( echo "Error during clean up." && exit 1 )
git submodule foreach git clean -fd || ( echo "Error during submodule cleaning." && exit 1 )