I am migrating from CVS to git. In CVS, I can use $Log$
in my comments section, and CVS will write comments at the point of $Log$
. Is there an equivalent for this in git?
I have looked and seen the powerful command line and add-on tools available to me, and I'll wind up using those if there is no equivalent, but I am just wondering if an equivalent exists.
Git doesn't support this be design, because you cannot update a file with commit info after committing, since git checksums the file first.
A workaround is to use attributes, using the "smudge" and "clean" filters and a post-commit hook. What these basically do is update the file with information once it is checked out, and remove the info before it is checked in.
My solution (written in Python) for the
$Date$
an$Revision$
keywords (the latter are implemented as to make use of tags) is available on github. You should be able to expand that for$Log$
.However:
You should think really carefully if you want this, because this approach has potential problems;
post-commit
hook if you want to use it.And last but not least, git commands like e.g.
git log
andgit diff
can give you much more information than a static log message.