我只想看到上次提交时提交的文件和git提交时看到的列表完全一样。不幸的是

git "last commit" log

在谷歌中我什么都得不到。和

git diff HEAD^..HEAD

当然,这并不是我所需要的,因为它也会释放出改变的本质。


当前回答

如果您只想看到上次提交的文件名称

 git diff HEAD@{1} --name-only

如果您还想看到内容更改,请删除——name-only

如果你想比较当前状态和旧的提交,增加{n}

其他回答

如果您只想看到上次提交的文件名称

 git diff HEAD@{1} --name-only

如果您还想看到内容更改,请删除——name-only

如果你想比较当前状态和旧的提交,增加{n}

在执行多次提交或克隆/提取存储库之后,您可能希望看到已经进行了哪些提交。只需检查这些简单的解决方案,查看您的提交历史(从上次/最近的提交到第一次提交)。

对于最后一次提交,只需执行以下命令:git log -1。更多有趣的事情请看下面

To see the commit ID (SHA-1 checksum), Author name <mail ID>, Date along with time, and commit message - git log To see some more stats, such as the names of all the files changed during that commit and number of insertions/deletions. This comes in very handy while reviewing the code - git log --stat To see commit histories in some pretty formats :) (This is followed by some prebuild options)- If you have too many commits to review, this command will show them in a neat single line: git log --pretty=oneline To see short, medium, full, or even more details of your commit, use following, respectively - git log --pretty=short git log --pretty=medium git log --pretty=full git log --pretty=fuller You can even use your own output format using the format option - git log --pretty=format:"%an, %ae - %s" where %an - author name, %ae - author email, %s - subject of commit, etc.

这可以帮助您处理提交历史。欲了解更多信息,请点击这里。

到目前为止,最简单的命令是:

git show --name-only

因为它只列出了上次提交的文件,并没有给你全部的胆量

输出的一个例子是:

commit  fkh889hiuhb069e44254b4925d2b580a602
Author: Kylo Ren <Kylo@darkside.empire.gov>
Date:   Sat May 4 16:50:32 2168 -0700

Changed shield frequencies to prevent Millennium Falcon landing

 www/controllers/landing_ba_controller.js             
 www/controllers/landing_b_controller.js            
 www/controllers/landing_bp_controller.js          
 www/controllers/landing_h_controller.js          
 www/controllers/landing_w_controller.js  
 www/htdocs/robots.txt                        
 www/htdocs/templates/shields_FAQ.html       

使用git显示:

git show --summary

这将显示已创建或删除的文件名,但不显示已更改的文件名。git show命令支持多种输出格式,用于显示关于提交的各种类型的信息。

要查看以前的提交SHA

git log -n 2 --pretty=format:"%h" | tail -n 1