2
2
2462014-07-21 12:36:41
PHP
246, 2014-07-21 12:36:41

How to put the version number of the php project through git?

Hello
I would like to automate the process of putting down project versions. For example, specify the version number in the tag of one of the commits, and then, based on this tag and the number of commits, indicate on the page the name of the form "'Version_number' assembly 'number_of_commits' from 'date'". Can you please tell me how to implement it correctly?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Vasiliev, 2014-07-21
@qmax

I think you need to dig here: git-scm.com/book/en/Customizing-Git-Git-Hooks I'm
too lazy to dig myself now. Please post if you find a solution.

F
falsebyte, 2014-07-21
@falsebyte

On the example of SVN: run through system (svn info) then take the necessary information, and the commit number and date of the commit and display it on the page.

E
EXL, 2014-07-22
@EXL

Hm. I don't know how it is in PHP, but in C++ projects, you can do without hooks. Here is an example:
Project file:

VERSION = $$system(git describe --tags)
isEmpty(VERSION) : VERSION = 0.9.02-dev
DEFINES += APP_VERSION=\\\"$${VERSION}\\\"

In C++:
...
setApplicationVersion(QLatin1String(APP_VERSION));
...

Bottom line:
I'm sure PHP has a solution for this as well. Here is an example:
stackoverflow.com/questions/16334310/i-want-to-dis...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question