Practical Web Programming

Wednesday, April 15, 2015

Easily Prepare master Branch for Deployment


1) Create a bash script named "prepare_for_deployment" in the root folder of your project and put the git command below:

    release_date=$(date +'%Y-%m-%d')
    git checkout master
    git fetch
    git reset --hard origin/master
    git merge origin/develop
    git push origin master
    git tag $release_date -m "$release_date"
    git push --tags origin $release_date
    
    
2) Make the file executable
    
    $ chmod u+x prepare_for_deployment
    
3) To run the script:

    $ ./prepare_for_deployment
    

NOTE: You can add the path to the script in your $PATH so you don't have to type "./" before the name.

0 comments:

Recent Post