3

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.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Lewis Bassett
  • 1,299
  • 1
  • 11
  • 17
  • possible duplicate of [To put the prefix ? to codes by Git/Svn](http://stackoverflow.com/questions/1127177/to-put-the-prefix-revision-number-to-codes-by-git-svn) – Gordon Feb 14 '12 at 10:13

1 Answers1

2

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.

Matthew
  • 1,555
  • 1
  • 13
  • 13
  • Thanks. I no longer use @version in my documentation. I think with Git, it's completely pointless. My next job at some point soon is to set up a CI server - that will produced numbered versions of packages. – Lewis Bassett Feb 24 '12 at 18:09