2

We currently store our version number in a file in git. Due to our crazy process, when in stabilisation phase - i.e. code freeze - every commit to the remote repository needs to update the version number in the file.

Our remote repository is hosted on Stash.

How can we enforce that every commit has modified this file as part of the commit, and ensure that no one accidentally forgets to update the file? If we have a pre-commit hook, then it requires every developer to be running the same environment (windows/linux) and it requires every developer to manually install the pre-commit hook (I think). Should it be enforced as a pre-push hook in git? What's the best way?

4
  • Isn't that something similar to what you want to achieve? stackoverflow.com/questions/16524225/… Commented Jul 9, 2014 at 14:06
  • @Wookie88 I don't think so, I don't need to update any files or worry about hashes. I just want to check that a file has been changed before it is merged into the remote repo Commented Jul 9, 2014 at 14:25
  • I mean you could make git automatically paste the version number into this file you want. Or maybe some shell script to do that automatically before commit... maybe just simple git commit wrapper? Leaving that to human is tiresome and unreliable ;). Commented Jul 9, 2014 at 14:52
  • can't avoid saying git really sucks at facilitating this kind of scenario, or most scenarios where human-readable incremental versioning is required. What you could do, is have a CI server take the latest hash and manufacture a new version number from it... which would be managed outside of git. Commented Nov 7, 2014 at 7:34

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.