Git log outputs in a specific revision range

后端 未结 1 1889
后悔当初
后悔当初 2021-02-01 18:01

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 :

相关标签:
1条回答
  • 2021-02-01 18:11

    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.

    0 讨论(0)
提交回复
热议问题