Quickly make a deploy folder from git

This is post is now quite old and the the information it contains may be out of date or innacurate.

If you find any errors or have any suggestions to update the information please let us know or create a pull request on GitHub

I needed to quickly generate a deploy folder that included all changes in the last two weeks. Using git and a little bit of bash magic I was able to put together a one liner to do this.

This works we use a public folder within our git structure which makes filtering the files easy, if you don’t have this then you will have to change the grep filter to match your needs. Obviously you can change the since filter to get the files you need.

git log –since=“2 weeks ago” –name-status | grep public | sort | uniq | awk ‘{print $2}’ | xargs -I % cp –parents % /path/to/deploy

Hope this helps in the future


Tags: gitbashlive deploymentone-linershelpful tips