-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush-last-commit.sh
More file actions
executable file
·29 lines (19 loc) · 962 Bytes
/
push-last-commit.sh
File metadata and controls
executable file
·29 lines (19 loc) · 962 Bytes
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
26
27
28
29
#!/bin/bash
set -e
COMMIT_NAME="$(git log -1 --pretty=%B)"
PATCH_NAME=$(git format-patch -1 "$(git rev-parse HEAD)")
RIVERADMIN_PATH="../../../riveradmin"
echo "Created patch: $PATCH_NAME"
if [ -d $RIVERADMIN_PATH ]
then
echo "Directory riveradmin exists"
else
echo "Directory riveradmin does not exist. Please pull riveradmin from GitLab to your projects folder"
exit 1
fi
mv "$PATCH_NAME" $RIVERADMIN_PATH && echo "Moved patch to riveradmin"
cd $RIVERADMIN_PATH && git fetch origin master && git reset --hard origin/master && git apply "$PATCH_NAME" && echo "The patch have been applied"
rm "$PATCH_NAME" && git add . && git commit -m "$COMMIT_NAME" && echo "Commit"
git push && echo "Push"
cd - && git fetch origin && git reset --hard origin/master
cd ../.. && git add . && git commit -m "Up-to-date admin" && echo -e "\nThe current project is up-to-date with admin and ready to push! Go to your project folder (cd ../../) and run git push\n"