Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a readme file to 'git archive' with commit hash

Tags:

git

When releasing versions of code to the customer it would be helpful to know the specific commit a copy of the code came from. Is it possible with 'git archive' to have the resulting .zip file include a readme.txt or some other indicator that shows the hash of the commit that was used?

I'm relatively new to git, having migrated from Mercurial. In Hg when it generated an archive the zip would include an hg_archive.txt with the hash indicating exactly where the archive was generated.

Thanks

like image 653
Max Daddy Avatar asked Oct 22 '25 04:10

Max Daddy


1 Answers

It's already there. See https://git-scm.com/docs/git-archive:

In ZIP files commit ID is stored as a file comment.

like image 178
phd Avatar answered Oct 23 '25 19:10

phd