What I’ve got is a local repository and 2 remote repositories (a bare called bare and a non-bare called dev).
What I’m trying to achieve is a simple deployment so that when I push to the bare repository the dev repository pulls the changes.
I am using a post-receive hook on the bare repository which simply does:-
cd (path-to-dev-repo)
unset GIT_DIR
git reset --hard HEAD # This is my failed attempt at stopping the merge conflicts
git pull origin master
When I make changes to my local repository and push them to the bare when the dev trys to pull it gives me things like:-
CONFLICT (add/add): Merge conflict in application/01_sql_schema.sql
However the only file changes I have made are to the local files – I don’t understand why the changes can’t be merged automatically when they have only been changed in one place.
Any help is much appreciated.
Edit: Alternative Possible Solution
Would it be better to have 2 bare repositories and checkout the development one to the desired folder from a hook?
Why are you using a repo for the deployed version?
Just use
GIT_DIR=path/to/app git checkout -fto checkout the files from the bare repo to the app location and avoid problems like these.