如何在git commit中获取更新文件夹的列表? [英] How can I get the list of updated folders in a 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屋!