amiceli
amiceli

Reputation: 445

Find more recent commit pointed a tag in all branch

I work on a PHP script who sends a Slack message when a one of our servers isn't up to date. Currently we use git tag for trigger build and publication.

So I search a git command to display most recent commit pointed a tag on any branch (for example more recent commit pointed on production-server-1 or demo-server-2 tag.

I tried following commands :

git --no-pager log -n 1 --format=%ai production-server-1

git rev-list  -n 1 production-server-1 | xargs git show

But outputed information doesn't match with our git repository information.

Is it possible to do this with a command line ?

Thanks

Upvotes: 1

Views: 47

Answers (1)

Timothée Jeannin
Timothée Jeannin

Reputation: 9912

You can use a combination of two git commands :

git show -s --format=%ci $(git rev-list -n 1 production-server-1)

Upvotes: 1

Related Questions