Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git log before some commit date

Tags:

git

I'm trying to get all commits before some date from AOSP (android open source project).
I found that I can do it by git command:
git log --before="2011-12-01"

But it shows me only author date (date when patch or change was uploaded buy not merged/changed)

Also I found that I can get date which I need by next git command:
git log --pretty=format:"%cd"
I't will show commit date.

And the question is:
how can get git log before some commit date?

like image 682
Laser Avatar asked Oct 01 '13 07:10

Laser


People also ask

What is the order of git log?

By default, with no arguments, git log lists the commits made in that repository in reverse chronological order; that is, the most recent commits show up first. As you can see, this command lists each commit with its SHA-1 checksum, the author's name and email, the date written, and the commit message.

How can I see the code of a previous commit?

All that you have to do is go on to the file that you committed on and go to the history for it, then select the earliest commit with the <> icon to view the code at that time.

What is git Shortlog?

The git shortlog command is a special version of git log intended for creating release announcements. It groups each commit by author and displays the first line of each commit message. This is an easy way to see who's been working on what.


1 Answers

Simply combine the two:

git log --before="2011-12-01" --pretty=format:"%cd"

As shown in "Git log: filter by commit's author date", git log filters by commit date, and the pretty=format will display just that.

From the man page:

Using more options generally further limits the output (e.g. --since=<date1> limits to commits newer than <date1>)

like image 51
VonC Avatar answered Nov 15 '22 21:11

VonC