Last active
May 31, 2018 10:20
-
-
Save skayikci/a9f7b1bfafe18d532e5889f99bad8a76 to your computer and use it in GitHub Desktop.
a bash script which pulls from master branch and creates a new tag with a given name, deletes existing upon request
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
#!/usr/bin/env bash | |
function quit { | |
exit | |
} | |
function createTag(){ | |
echo "Changing to master branch for $1" | |
cd "/$1" | |
git status | |
git checkout $BRANCH | |
git pull origin $BRANCH | |
LASTTAG=$(git describe --abbrev=0 --tags) | |
PREVIOUSTAG=HEAD | |
echo "Differences between $LASTTAG and HEAD" | |
git log $LASTTAG..HEAD --pretty=oneline > ../tag$PREVIOUSTAG$LASTTAG.$1.log | |
#git log --pretty=oneline $LASTTAG...HEAD | |
if [ $DELETEEXISTING == "y" ]; then | |
git push --delete origin $TAG | |
git tag --delete $TAG | |
fi | |
git tag $TAG | |
git push origin $TAG | |
if [ $? -eq 0 ]; then | |
echo "OK for $1" | |
else | |
echo "Failed for $1" | |
fi | |
} | |
echo -n "GIT TAG": | |
read TAG | |
echo -n "FROM WHICH BRANCH?" | |
read BRANCH | |
echo -n "DELETE EXISTING y or n": | |
read DELETEEXISTING | |
#LIST OF PROJECTS | |
createTag "" | |
quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment