Git log foo..bar - how to see * merge dates * for change sets?

Is it possible to get 'git log' to indicate the date when the change set landed on the branch, and not on the date the change set was created? 'git log -graph' (an example of abbreviated output below) gives me a lot of what I want, but it still prints the dates when the individual changes were created, and not when they were merged into this branch.

* commit 7e8d68fc58b915cc17bca41be833c4f7a062cd3c |\ Merge: 1b4f10d af0dcdd | | Date: Wed Apr 25 17:40:16 2012 +0100 | | Merge branch 'foo' | * commit af0dcdd078197a852fcfad11c5111aa11579aa05 | | Date: Wed Apr 25 17:36:50 2012 +0100 | | t2: adding lorem ipsum again | * commit 569f5de0eb40cbf198771812f9b099cf71b5b056 | | Date: Wed Apr 25 17:36:36 2012 +0100 | | t1: adding lorem ipsum * | commit 1b4f10d3eea7c9c6304f7b1fd41818b932e4dad0 | | Date: Wed Apr 25 17:38:24 2012 +0100 | | t4: fi fo fa fum x 2 * | commit d25fa0359fbe655b6a4adeb6225ac283b3543ece |/ Date: Wed Apr 25 17:38:10 2012 +0100 | t3: fi fo fa fum * commit d3239b3e327f740fc7194ecf164538361f715ab5 Date: Wed Apr 25 17:34:50 2012 +0100 

In the above, the output is from the master branch. t1 and t2 were created on the foo branch; t3 and t4 were created on bar . Then bar was merged into master , and then merging foo into master.

+7
source share
1 answer

You can see part of the answer: When the foo branch was merged into master , it created a new commit (7e8d68) with two parents.

But when bar was merged into master , it was a quick switch. That is, all the commits on bar were newer than the newest work on master , so they could simply be attached to the end.

This simplifies the layout, and therefore this is the default behavior. But he does not leave a record of the merge - as far as your story is concerned, it will look as if these commits were made to master in the first place.

To get around this, you can explicitly specify git to avoid smoothing fast forward, i.e. each single merger should result in a merger with two parents, even if an accelerated merger were possible. To do this, simply use the --no-ff flag in the git merge command.

Unfortunately, due to the fact that changing the merge, rather than logging the behavior, you will not be able to do this retroactively - the information from your previous smoothing fast forward does not exist, therefore there is no way to get git log to display it.

+4
source

All Articles