Last active
December 16, 2015 04:49
-
-
Save HugoPoi/5379565 to your computer and use it in GitHub Desktop.
Auto-merge script for git repo. You must use auth 'ssh' and a cron task.
Then add a tag to your branch with the prefix pattern, the script will auto merge to the last tag version.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Auto-merge script for git repo | |
# You must use auth 'ssh' and a cron task :-) | |
# Conf: | |
REPO_PATH=/home/user/yourgitrepo | |
TAG_PATTERN=prod* | |
# Conf End | |
cd $REPO_PATH | |
git fetch --tags | |
lasttag=$(git tag -l $TAG_PATTERN | sort -n | tail -1) | |
if [ "$lasttag" != "" ] ; | |
then error=$(git merge $lasttag 2>&1) | |
if [ "$error" != "Already up-to-date." ] ; | |
then echo "Auto Merge $REPO_PATH to : $lasttag \n $error" | /usr/bin/mail -s "Auto-Merge" [email protected] | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment