Skip to content

Instantly share code, notes, and snippets.

@mgirouard
Last active December 22, 2015 02:20
Show Gist options
  • Save mgirouard/5853000 to your computer and use it in GitHub Desktop.
Save mgirouard/5853000 to your computer and use it in GitHub Desktop.
A minimal git deployment script
#!/bin/bash
git push $1 +HEAD:master
git fetch $1
git push origin --tags
#!/bin/bash
read oldref newref refname
target=/var/www/vhosts/www.example.com
echo Deploying to ${oldref:0:7}..${newref:0:7} to $target
GIT_WORK_TREE=$target git checkout -f
git diff --stat $oldref..$newref
@mgirouard
Copy link
Author

Save as ~/bin/git-deploy, then:

chmod +x ~/bin/git-deploy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment