Hello, I am having some difficulty understanding what I am doing wrong when working with git to deploy a website through the use of a post-receive hook on the remote. Here is the script: #!/bin/sh staging_path="/home/user/domains/domain.com/public_html/staging" live_path="/home/user/domains/domain.com/public_html/live" while read oldrev newrev ref do branch=$(echo $ref | cut -d/ -f3) # *** # update the live site # if [[ "master" == "$branch" ]]; then export GIT_WORK_TREE=$live_path git checkout -f $branch echo "Release has been pushed to production" # *** # we update the staging server with the latest push # elif [[ "develop" == "$branch" ]]; then echo "Resetting staging tree" export GIT_WORK_TREE=$staging_path git checkout -f $branch echo "Develop has been pushed to staging" fi done This is what we have done: git checkout develop touch 1 2 3 4 5 6 git add . git commit -am "added some files" git push origin develop checking the remote server now all files are found in: /home/user/domains/domain.com/public_html/staging git checkout master git merge develop git push origin master checking the remote server now all files are found in: /home/user/domains/domain.com/public_html/live git checkout develop git rm 4 5 6 git commit -am "removed some files" git push origin develop checking the remote server now files 4 5 6 have been removed from: /home/user/domains/domain.com/public_html/staging git checkout master git merge develop git push origin master checking the remote server files 4 5 6 are still found in: /home/user/domains/domain.com/public_html/live Why is this happening? checking the local repo for master shows the files are removed there... pulling the latest from origin:master shows the files have been removed... but why were they not removed from the working tree like they were on the staging working tree? well I think it has something to do with later commits and therefor the working tree of the live server could quickly become out of sync with the development tree a quick test, lets checkout master again and perform the removes directly on it then push it back: git checkout master git rm 1 2 3 git commit -am "removed 1 2 3" git push origin master checking the remote server now files 1 2 3 have been removed from: /home/user/domains/domain.com/public_html/live Okay weird so they remove when the commit happens directly on that branch and is pushed to the remote but they dont get removed if the removal happened on a different branch and is merged in then pushed to the remote.... anyone have an explanation or a workaround? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html