X
X
xbox2016-08-31 16:57:03
git
xbox, 2016-08-31 16:57:03

How to make PhpStorm or Git automatically add file modification time, author, file weight, etc. to the code?

I am using phpstrom+git.
Since the time of the original developers of a project, most files contain information about who created the file and when and who last modified it and when, plus the version of the file and the name of the project. An example of such headers is below. The first developers used SVN instead of Git, but the essence of this does not change.

**
 *  YYYY actions.
 *
 * @package    XXXXXX
 * @subpackage YYYYY
 * @author     Zzzzzzz  Zzzzzzz <[email protected]>
 * @version    SVN: $Id: actions.class.php 30461 2011-04-26 14:11:12Z petrov $
 */

How to make either phpStorm fill in this service information when saving, or Git when committing? In git, I can see the modification time of a file, but I want it to be right in the code.
I think it's a standard thing that most of the developers who work in large teams use. But for some reason I can't google the solution.
In phpStrom I found "File & Code Templates". There is an opportunity to set such comments when creating a file, but this is not quite what you need. Those. when manually creating a phpstorm php file, this thing can and does work, albeit with some limitations. But if I run some framework command that generates files, then all these files will naturally be without headers.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2016-08-31
@zoonman

You can write your own pre-commit hook. https://github.com/phpDocumentor/ReflectionDocBlock will help you create or edit existing templates.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question