Skip to content

Instantly share code, notes, and snippets.

@hereswhatidid
Created August 29, 2014 18:07
Show Gist options
  • Save hereswhatidid/da1af829d0a4217e9d24 to your computer and use it in GitHub Desktop.
Save hereswhatidid/da1af829d0a4217e9d24 to your computer and use it in GitHub Desktop.
Custom file deployment actions for SourceTree. The zip archives generated retain directory structure so you can FTP them to a remote server in one shot. Actions are set up under Preferences -> Custom Actions and all have the Parameters set to "$REPO, $SHA"
#!/bin/sh
# creates a zip archive of the files modified in a merge.
args=("$@")
git archive -o deploy/deploy-${args[1]:0:7}.zip HEAD $(git diff-tree --no-commit-id --name-only -r ${args[1]})
#!/bin/sh
# creates a zip archive of the files modified in a commit
args=("$@")
git archive -o deploy/deploy-${args[1]:0:7}-${args[2]:0:7}.zip HEAD $(git diff-tree --name-only -r ${args[1]} ${args[2]})
#!/bin/sh
# creates a zip archive of the files modified between two commits
args=("$@")
git archive -o deploy/deploy-merge-${args[1]:0:7}.zip HEAD $(git log -m -1 --name-only --pretty="format:" ${args[1]})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment