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

git "last commit" log

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

git diff HEAD^..HEAD

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


当前回答

查看上次提交的更改

git show HEAD

或者查看第二个最后提交的更改

git show HEAD~1

此外,只需将上面的“1”替换为所需的提交序列号。

其他回答

要查看最后一次提交:

git log -1

要查看最后2次提交:

git log -2

等等....

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

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       

我们不了解这些人

这显示了与上次提交相同的diffstat。

要查看以前的提交SHA

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

可以工作