如何列出作为特定提交的一部分而更改的文件?

时间:2018-06-05 05:46:08

标签: git git-show

如何以下面的格式列出作为特定提交的一部分完成的更改?

repo: agrawalo/interviewing
branch: master 
commit: c917020b 

Batman! This commit has no parent

author: Lokesh Agrawal at 2018-05-16T20:58:17+05:30 

Summary of changes:
pom.xml | 10 +++
+ src/main/java/DBTest.class | 10 +++--
+ src/main/java/DBTest.java  | 8 +++-
src/main/java/com/interviewing/Application.java | 8 ++++
+ src/main/java/com/interviewing/constant/QuestionArea.java | 88 +++-
+ src/main/java/com/interviewing/controller/QuestionController.java | 78 +++--
src/main/java/com/interviewing/entity/Question.java | 17 ++++++
src/main/java/com/interviewing/entity/Skill.java | 23 ++++++++
src/main/java/com/interviewing/repository/QuestionRepository.java | 37 ++++--
+ src/main/java/com/interviewing/repository/SkillRepository.java | 9 ++++++-
+ src/main/java/com/interviewing/service/QuestionService.java | 11 ++++++-
+ src/main/java/com/interviewing/service/QuestionServiceImpl.java | 20 ++++--
src/main/resources/application.properties 13 ++++++
+ src/test/java/com/interviewing/repository/QuestionRepositoryTest.java | 23 +++-----

n files changed, x insertions(+), y deletions(-)

我试过了

git show --name-only #commithash

commit eaf678f74e35affaeaa21a0df5bf086e804bcad5
Author: Lokesh Agrawal <agrawalo@deshaw.com>
Date:   Fri May 11 12:23:27 2018 +0530

Batman! This commit has no parent

.gitignore
mvnw
mvnw.cmd
pom.xml
src/main/java/com/interviewing/Application.java
src/main/java/com/interviewing/entity/InterviewMatrix.java
src/main/java/com/interviewing/entity/Question.java
src/main/java/com/interviewing/repository/InterviewMatrixRepository.java
src/main/java/com/interviewing/repository/QuestionRepository.java
src/main/resources/application.properties
src/test/java/com/interviewing/StructuredInterviewingApplicationTests.java

但它没有指示文件是新添加的还是现有文件中的某些内容已更改。

3 个答案:

答案 0 :(得分:0)

git show --name-only应该做你想做的事。

修改
git show --name-status还会显示文件中已更改的内容。例如。添加“A”并修改“M”。

答案 1 :(得分:0)

尝试git show --name-status

注意: --name-only--name-status也是git diffgit log和其他一些git命令的有效选项

答案 2 :(得分:0)

我不知道这是否正是您想要的,但您可以使用以下命令查看作为提交的一部分修改的文件列表:

git log --stat

这将列出所有提交以及为每次提交修改的文件列表。