如何在git commit中获取更新文件夹的列表? [英] How can I get the list of updated folders in a git commit?

查看:108
本文介绍了如何在git commit中获取更新文件夹的列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一种仅获取上次提交中已更新的文件夹列表的方法.我尝试使用git status --porcelain,但它提供了已更新文件的列表.

I am trying find a way to get only the list of folders which got updated in the last commit. I tried to use git status --porcelain but it gives the list of files which got updated.

?? folder1/test.txt
?? folder3/test2.txt

我绝对可以从上面的结果中提取文件夹名称,但是我想知道是否有针对此的现成解决方案.我正在寻找的只是

I can definitely extract the folder name from above result but I was wondering if there is a ready made solution for this. What I am looking for is just

folder1
folder2

推荐答案

您可以使用--dirstat显示提交在目录中引入的更改.使用git show --dirstat将显示当前提交的目录统计信息.您可以git show --dirstat <commitish>显示特定提交的目录,或git diff --dirstat显示任意差异引入的更改.

You can use --dirstat to show the changes a commit introduces within directories. Using git show --dirstat will display directory stats for the current commit. You can git show --dirstat <commitish> to show a dirstat for a specific commit, or git diff --dirstat to show the changes an arbitrary diff introduces.

有关详细信息,请参见 git-diff手册页.

See the git-diff man page for specifics.

这篇关于如何在git commit中获取更新文件夹的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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