Git development
 help / color / mirror / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Larry Martell <larry.martell@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: hook to get info on commit, and include that in a file that is part of the commit
Date: Tue, 5 Feb 2019 02:15:13 +0000	[thread overview]
Message-ID: <20190205021513.GC527887@genre.crustytoothpaste.net> (raw)
In-Reply-To: <CACwCsY4fwr6=2S5CHe5bH7=7Hukq9np+eT1VO+kUDyBtMLKPcA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]

On Mon, Feb 04, 2019 at 09:00:42PM -0500, Larry Martell wrote:
> Thanks for the reply. Any suggestions on how to achieve what I want to do?
> 
> The use case is that we want to have a file that is part of the
> install that has certain info (commit id, date of commit, commit
> message, etc.). and we'd like that to be generated automatically.

If you want to generate a file, you can certainly do that in the
post-commit hook or using a Makefile target. You just can't check it
into the repo. Lots of projects do this as part of their build process.

An example of what you could do is "git log --pretty='tformat:%H%n%B' HEAD".
That will print the commit hash and commit message to standard output
for each commit. If you want just one commit, you can use "-1".
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 868 bytes --]

  reply	other threads:[~2019-02-05  2:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-05  1:36 hook to get info on commit, and include that in a file that is part of the commit Larry Martell
2019-02-05  1:55 ` brian m. carlson
2019-02-05  2:00   ` Larry Martell
2019-02-05  2:15     ` brian m. carlson [this message]
2019-02-05  2:18       ` Larry Martell
2019-02-05  2:40         ` brian m. carlson
2019-02-05  2:42           ` Larry Martell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190205021513.GC527887@genre.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=larry.martell@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox