Last active
August 29, 2015 13:56
-
-
Save raulillana/8929345 to your computer and use it in GitHub Desktop.
Automatically migrates a folder structure of software versions to a GitHub working copy and creates tags for each version. FOLDERS 2 GITHUB #fd2gh <3
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/bash | |
# activate logs | |
LOGERROR="/Users/activeuser/Desktop/project-error_log.txt" | |
LOGEXEC="/Users/activeuser/Desktop/project-exec_log.txt" | |
# print errors to logs | |
exec 1> $LOGEXEC | |
exec 2> $LOGERROR | |
# activate trace on script | |
# -x -> activate trace | |
# -v -> verbose | |
# -e -> end script execution if error | |
set -x -v | |
# versions array | |
VERSIONS="1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4 1.4.1 1.5 1.5.1 1.5.2 1.6 1.6.1 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.8 1.8.1 1.8.2 1.8.3 2.0 2.1 2.1.1 2.2 2.3 2.4 2.5 2.5.1 2.5.2 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 3.0 3.0.1 3.0.2 3.1 3.1.1 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.3 3.3.1 3.4 3.4.1 3.4.2 3.4.3 3.5 " | |
# go to master branch | |
cd /Users/activeuser/GIT/project/ | |
# version iteration | |
for VER in $VERSIONS | |
do | |
# rsync version from location to master branch | |
# -r -> recursive | |
# -t -> preserve file timestamps | |
# -v -> verbose | |
# -u -> work with updated only files | |
# --delete -> care of deleted files | |
rsync -rtvu --delete /Users/activeuser/Dropbox/project/$VER/ /Users/activeuser/GIT/project/ | |
# add the new files | |
git add -A | |
# diff files | |
git diff --staged | |
# commit new version in master | |
git commit -m "add v$VER" | |
# create tag from master | |
git tag -a $VER -m "tag v$VER" | |
# push master to origin | |
git push origin master | |
# push master to origin | |
git push --tags | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment