Question

I write my code in Netbeans and use Git as my versioning control system.

I've seen that if I were to use SVN, I could add $Id$ to my docblocks, so that a version is automatically inserted for each change committed, like:

<?php
/**
 * Widget class definition file.
 * 
 * @author Me <me@example.com>
 * @copyright Copyright (c) 2012, Me
 * @version $Id$
 * @package Widgets
 */

Is there a way to do this with Git?

How do you guys manage your version numbers in your documentation? It's a real pain to update manually, and isn't really practical.

Was it helpful?

Solution

git doesn't support this behavior (I won't call it a "feature"). I never liked it with CVS because it would cause false merge conflicts.

git describe gives you a version number based on your tags. You could copy it in as a search and replace w/ sed or something as a step in your documentation compilation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top