如何查看上次提交中更改了哪些文件 [英] How to see which files were changed in last commit

查看:58
本文介绍了如何查看上次提交中更改了哪些文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此提交消息中,它说2个文件已被更改.

In this commit message, it says that 2 files have been changed.

$ git commit -m "fixed .gitignore"
[master c30afbe] fixed .gitignore
 Committer: Sahand Zarrinkoub <sahandzarrinkoub@n133-p41.eduroam.kth.se>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 2 files changed, 5 insertions(+), 4 deletions(-)

这对我来说有点令人惊讶.我以为我只会上演一个要更改的文件.现在,我想看看哪些文件已更改以及如何更改.这样做的方式是什么?

This is a little surprising for me. I thought I'd only staged one file to be changed. Now, I'd like to see which files have been changed and how. What is the way to do this?

推荐答案

您可以尝试 git log --stat

此处-stat 将显示每次提交更改的每个文件的插入和删除次数.

Here --stat will display the number of insertions and deletions to each file altered by each commit.

示例:下面的提交在 Demo.java 文件中添加了67行,并删除了38行:

Example: Below commit added 67 lines to the Demo.java file and removed 38 lines:

commit f2a238924456ca1d4947662928218a06d39068c3
Author: X <X@example.com>
Date: Fri May 21 15:17:28 2020 -0500
Add a new feature
Demo.java | 105 ++++++++++++++++++++++++-----------------
1 file changed, 67 insertion(+), 38 deletions(-)

这篇关于如何查看上次提交中更改了哪些文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆