A Pointer for your question: In principle you can get the state of the remote repository with git fetch
. This Command gets the remote state and updates the origin/feature/foo
branch. You should be able to use this to build your desired hook.
BUT! In principle you're just trying to recreate a situation where you use git like subversion. The big advantage of git is, that you are able to make commits completely independent of the remote repository. (For example do commits and use them to revert if you make mistakes while you're offline deep inside narnia or something)
If you have the problem that your mergeconflicts are too big too handle it seems more like a problem in your process. Maybe try to focus on smaller feature branches to prevent big mergeconflicts.
So I would guess solving this problem with a commit hook is not the best way to go.