Put this in a file called pre-commit
in .git/hooks/
#!/bin/sh
# To enable this hook, rename this file to "pre-commit".
git rev-list --count master > build_number
git add build_number
Now there is a file called build_number
in the root of your directory that counts the number of commits on your master branch (which is your build number).
Make sure the permissions on the file you created are the same as the samples in that directory.
Hi, I am new to github. I have been asked to maintain version number of my works. could you please help me to setup the version. I went through the above code but understanding it.
Regards,
S.