Git keyword substitution like those in Subversion?

Viewed 30441

I used to work under Subversion/SVN and was instantly using nice feature called keyword substitution. Just putting in source files smth like:

/*
 *   $Author: ivanovpv $
 *   $Rev: 42 $
 *   $LastChangedDate: 2012-05-25 21:47:42 +0200 (Fri, 25 May 2012) $
 */

And each time Subversion was substituting keywords (Author, Rev, LastChangedDate) with actual ones.

Some time ago I was forced to move to Git and just wondering is there's something similar to Subversion's keyword substitution in Git?

4 Answers

The idea that keyword expansion is "not recommended" and "isn't really useful" is absurd. Whether you are compiling code into binary files, JAR files, or anything else, every source code system since SCCS in the 1970's has supported a form of keyword expansion. The purpose is to allow a developer to look at any derived artifact in any environment and trace back to the exact revision of every source file that went into the artifact. Without some form of keyword expansion, that is impossible, and you are left to guess.

Related