I'm hoping someone is able to shed some light on the voodooo that is auto updating files on a network drive.
On my local drive (c:/dev/project) i have a git repo which has a remote on bitbucket, the remote network drive (x:/hdd/project) is a full git clone which also has a remote of origin pointing to bitbucket. It is possible to work on either drive and both sites are available to my browser.
Currently if i do some changes on the local drive (c:) and do a git push the files go into bitbucket then i need to change to the remote drive (x:) and do a git pull.
This is all well and good but if i forget to do this and someone works on the project and forgets to do a git pull before starting then there will be conflict issues.
I've read I can setup a git hook to update on git push from local (c:) but the documentation and examples are not very clear. I've also read I can use a remote in addition to origin but again the documentation is limited and didn't help me understand what i need to do.
So for a remote i looked over http://tony.halcyonlane.com/blog/2011/09/22/Using-git-at-work-on-a-Windows-network-drive/ this uses origin but obviously i can call it anything (say dev-box). This also says i need to create the clone using --bare which was not done on these dev folders. This is also 7 years old so unlikely to be too relevant.
for git hooks i looked over https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks
#!/bin/bash
unset GIT_INDEX_FILE
git --work-tree=/var/www/html --git-dir=/home/demo/proj/.git checkout -f
which is confusing so is --work-tree the local (c:) and -git-dir the remote(x:) and does this need to be on the remote and not the local?
As you can see more questions than answers. I just need a clear explanation or a good example i can follow.
thanks
Craig