Cyril N.
Cyril N.

Reputation: 39889

How to read the content of a file in a post-receive hook?

I'm building a hook for the post-receive and I need to read the content of a file (VERSION). This file can change along with the commit (new version) so I can't read an existing repo.

I tried this method :

git cat-file blob $(git ls-files -s VERSION | awk '{print $2}')

But in the hook folder, it doesn't work.

How can I do this?

Upvotes: 0

Views: 599

Answers (1)

michas
michas

Reputation: 26555

simply use

git show $commit:$file

Upvotes: 3

Related Questions