Even though they have been asked to update sourcetree before a commit they sometimes for get and it causes them to lose work and or mess up our git
Hi there,
This shouldn't be a problem as if they try to push and new commits have been pushed to the remote since their last pull then git/hg will ask them to pull and merge changes before pushing, so they shouldn't lose any work. DVCS's are designed to do this specifically so you don't lose any changes.
You can set up commit hooks which perform some action before a commit. If you browser to ".git/hooks/" in your project directory there's a number of ".sample" files, you'd want to use the pre-commit.sample file and enter a git command in there which will get exected before they commit. Rename the file to just "pre-commit" once you're done and it'll be exected before the commit happens.
I wouldn't suggest this, however, because you shouldn't be losing any changes at all in your process even in your case. There are many times I attempt to do a push and changes have been pushed since my last pull, but I never lose changes because I'm now allowed to push until I pull and merge changes. Perhaps there's something else wrong with the process here - in any case, I wouldn't suggest using hooks to get around the problem you're having. It'd be good to know more about your workflow to find out why this is happening.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.