How do I get last commit date from git repository?

Narendra Vadnere picture Narendra Vadnere · Aug 29, 2014 · Viewed 40.8k times · Source

I need the last commit date in git. This means the latest update date in my program.

I used the command : $ git log -1 but this command will give me the date from the local repository. Rather I need date from remote repository.

I tried some commands as follow.

git log -n 1 origin/Sprint-6.
git rev-parse --verify HEAD

Answer

love picture love · Aug 29, 2014

The following command will be helpful:

git log -1 --format=%cd 

This will print the latest change date for one file. The -1 shows one log entry (the most recent), and --format=%cd shows the commit date. See the documentation for git-log for a full description of the options.