Last Updated: February 25, 2016
·
545
· jondruse

Custom git script for use with git based deployment

We use CI for git workflow deployments. Here's a handy script to not take you away from what you're working on.

Put this into a file called git-deploy somewhere in your $PATH and make it executable.

#!/bin/bash

BRANCH=$(git rev-parse --abbrev-ref HEAD)
echo 'currently on' $BRANCH

echo 'co and pull master'
git checkout master
git pull --ff-only

echo 'co and pull production'
git checkout production
git pull --ff-only

echo 'merge and push'
git merge master
git push

echo 'switching back to' $BRANCH
git checkout $BRANCH

now you can run this like any other git command

$ git deploy