Git log outputs in a specific revision range

caesar picture caesar · Sep 3, 2013 · Viewed 25.5k times · Source

Here is my problem. How could I get all log messages between 2 revision numbers for a specific path ? let me explain via example.

I tried to write it with this line :

git -dir=/home/Desktop/GIT_REFERENCE_REPOSITORIES/manager.git log  10000...15000

I assumed it gives me the log messages related to manager.git between 10000 and 15000 revisions. But it doesn't. Is there anyone to help me ?

Answer

eckes picture eckes · Sep 3, 2013

A revision is specified by its SHA1 hash.

If you want to see commits for specific files, you have to separate paths with --:

git log oldhash..newhash -- path/to/inspect

does this.

Also note that you are using three dots (...) to specify the range. Usually, you only want two dots.

Three dots might not give the result you'd expect. As the man page for gitrevisions (section SPECIFYING RANGES) says, while

git log a..b

means give me all commits that were made since a, until and including b (or, like the man page puts it "Include commits that are reachable from b but exclude those that are reachable from a"), the three-dot variant

git log a...b

means "Include commits that are reachable from either a or b but exclude those that are reachable from both", which is a totally different thing.