Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git log outputs in a specific revision range

Tags:

git

git-log

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 ?

like image 493
caesar Avatar asked Sep 03 '13 14:09

caesar


People also ask

How do I limit a git log?

The most basic filtering option for git log is to limit the number of commits that are displayed. When you're only interested in the last few commits, this saves you the trouble of viewing all the commits in a page. You can limit git log 's output by including the - option.


1 Answers

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.

like image 110
eckes Avatar answered Sep 18 '22 22:09

eckes