\n#!\/bin\/bash<\/code><\/p>\nTARGET=”\/your\/deployment\/path”
\nMOST_RECENT=$(git log -n 1 –pretty=format:’%h’)
\nPREV=$(git log –skip=1 -n 1 –pretty=format:’%h’)<\/p>\n
echo “Coping to $TARGET”
\nfor i in $(git diff –name-only $MOST_RECENT $PREV)
\ndo
\n# First create the target directory, if it doesn’t exist.
\nmkdir -p “$TARGET\/$(dirname $i)”
\n# Then copy over the file.
\ncp “$i” “$TARGET\/$i”
\ndone
\nexit 0<\/p>\n
Thanks to the following articles about pre-push hooks and how to get the files\u00a0between commits.<\/p>\n
http:\/\/www.phprepo.in\/2012\/04\/git-copy-all-changed-files-between-two-commits-with-directory-structure\/<\/p>\n
http:\/\/blog.ittybittyapps.com\/blog\/2013\/09\/03\/git-pre-push\/<\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[6],"tags":[],"yoast_head":"\n
Git Copy - My Monkey Do<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n