Enissay
Enissay

Reputation: 4953

Get the last version's date on git

I want to get the last version's date for a project on git... Meaning the date of the last change for projects like:

Im not familiar with git, and after many searches I tried this:

$ git --version
git version 1.8.1.2    
$ git log -1 --format="%ct" http://selenium.googlecode.com/git/
fatal: Not a git repository (or any of the parent directories): .git

The code is inteneded to be executed from php through exec(), and the returned date will be formatted later...

Upvotes: 1

Views: 1041

Answers (2)

Learath2
Learath2

Reputation: 21403

It's not possible for git to connect to a server and check its log. You need to either clone the repo and get the date with git log -1 --format="%ci" or use an API provided by the host, Github has an API not sure about google code but you could parse the site to get the information.

Upvotes: 1

ian
ian

Reputation: 12251

This will show you the latest commit on each branch, so the first in the list is the latest commit for the entire project:

git for-each-ref --sort=-committerdate refs/heads/ --format="%(authordate) %(refname)"

It'll be up to you to use PHP to handle the output.

Upvotes: 0

Related Questions