2

I am using PHP and have a file version.php contains the following line:

<?php   
      define('VERSION', '1.1.0');
      define('BUILD', 'xxx');

I want the git to replace the xxx before commit. The xxx can be anything unique and not necessary the git hash number.

Since it is PHP script and does not require another compilation process, and since the chance of build number is very frequent, I just want to have fully automatic process such that it will be changed everytime when user commit the code.

What is the perferred way to do it?

1
  • props on using git by the way :) Commented Nov 10, 2012 at 6:16

2 Answers 2

4

The general way of doing this would be with a pre-commit hook.

Sign up to request clarification or add additional context in comments.

Comments

0

You can think about "clean" and "smudge" filters

Comments

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.