1

I am looking for a way to add the author date to the commit message in GIT, using the prepare-commit-msg hook. This is necessary for a GIT->TFS migration workaround. I came up with the following script, but I couldn't find a way to reference the current commit, so that it would work properly.

#!/bin/sh
git show -s --format="<timestamp>%ai</timestamp>" %curcommit >> $1

What should I insert instead of %curcommit in order for the script to work as intended?

JonathanReez
  • 1,559
  • 3
  • 21
  • 37
  • 1
    Take a look at the `--date` option to `git commit`, as well as the `commit.template` configuration option documented in `git help config`. One or the other should help you out. – chepner Jun 20 '13 at 14:24
  • What git operation are you doing, when you expect the hook to do this? – SzG Aug 01 '13 at 22:32

0 Answers0