jon-b of 9seeds
8/29/2014 - 6:15 PM

Custom file deployment actions for SourceTree. The zip archives generated retain directory structure so you can FTP them to a remote server

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-merge-${args[1]:0:7}.zip HEAD $(git log -m -1 --name-only --pretty="format:" ${args[1]})
#!/bin/sh


# creates a zip archive of the files modified between two commits

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 in a commit

args=("$@")

git archive -o deploy/deploy-${args[1]:0:7}.zip HEAD $(git diff-tree --no-commit-id --name-only -r ${args[1]})