Howard
Howard

Reputation: 19805

Automatic updating build number before commit to git

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?

Upvotes: 2

Views: 657

Answers (2)

Lazy Badger
Lazy Badger

Reputation: 97282

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

Upvotes: 0

Amber
Amber

Reputation: 526583

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

Upvotes: 4

Related Questions