Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can git diff include the latest author and revision date?

Tags:

git

git-diff

When I merge branches, I frequently want to get a summary of all the file differences between the branches.

git diff --stat -r branch1..branch2 works great for this, but I want to have author and date from the latest commit that touched that file as well. The output would look something like this:

ChangeColumns.cls                   | Author1 |  2/10/2015 | 95 ++++++++--------------
GiftApprovalController.cls          | Author2 |  2/11/2015 |  2 +-
MassRelationshipCreation.cls        | Author3 |  2/10/2015 |  2 +-
MultiselectedPicklist.cls           | Author4 |  2/08/2015 | 17 ++--
Paginator.cls                       | Author1 |  2/09/2015 | 11 ++-
PipelineManager.cls                 | Author4 |  2/10/2015 |  7 +-
TestSetupUtils.cls                  | Author4 |  2/08/2015 | 13 ++-
PipelineManager.page                | Author2 |  2/07/2015 |  5 +-
TestCoverageJsonData.resource       | Author1 |  2/10/2015 | 10 ++-
9 files changed, 78 insertions(+), 84 deletions(-)

Is there any way to do this?

like image 588
Greg Grinberg Avatar asked May 27 '26 07:05

Greg Grinberg


1 Answers

Though not exactly but git log should get you something closer to what you expect,

git log branch1..branch2 --pretty=format:"%h%x09%an%x09%ad%x09%s"

This will only show you commit differences that branch2 has but branch1doesn't. You will have to reverse it for the getting the commits present in branch1 but not in branch2.

Add a --stat or --name-only to obtain file names

git log branch1..branch2 --pretty=format:"%h%x09%an%x09%ad%x09%s" --stat
like image 180
pratZ Avatar answered May 30 '26 04:05

pratZ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!