在 Git 中查看权限更改
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5094376/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
View permissions change in Git
提问by Clutch
Before I commit some files, how can I see the file permission changes to files? I have some files that git status says had changed and should be added to commit but git diff doesn't show anything. Thanks
在提交某些文件之前,如何查看文件的文件权限更改?我有一些 git status 说已更改的文件,应该添加到提交中,但 git diff 没有显示任何内容。谢谢
回答by Jeff Ferland
git log --summary
will get you what you're looking for, I think. The flag will, "Output a condensed summary of extended header information such as creations, renames and mode changes."Note the example below:
git log --summary
会给你你正在寻找的东西,我想。该标志将“输出扩展标题信息的精简摘要,例如创建、重命名和模式更改。” 请注意以下示例:
$ git log --summary
commit 8978a03a209d1cc4842a8ff14b00253cb7744895
Author: Me
Date: Wed Feb 23 12:43:30 2011 -0500
second
mode change 100644 => 100755 matrix.cc
commit e559dcbee268448d4185854c056174dcb87d3013
Author: Me
Date: Wed Feb 23 12:43:10 2011 -0500
first
create mode 100644 matrix.cc
回答by Jeff Ferland
Well, since the question has been edited to ask something different, here's a different answer:
好吧,由于问题已被编辑以提出不同的问题,因此这里有一个不同的答案:
git status -v
will list mode changes as well as diffs. You can filter this down to just mode changes by running it through grep with a context filter: git status -v | grep '^old mode' -C 1
(sample result below)
git status -v
将列出模式更改以及差异。您可以通过使用上下文过滤器通过 grep 运行它来将其过滤为仅模式更改:(git status -v | grep '^old mode' -C 1
下面的示例结果)
diff --git a/matrix.cc b/matrix.cc
old mode 100644
new mode 100755
回答by MatteoOreficeIT
I used this
我用过这个
git status --porcelain=2 | grep '100755 100755 100644' | cut -d' ' -f9
you can change the three masks 100755 100755 100644 with ones you are looking for
您可以将三个面具 100755 100755 100644 更改为您正在寻找的面具
回答by Eugen Mihailescu
A straightforward answer to your question:
直接回答你的问题:
git diff --summary
will output something like this:
将输出如下内容:
mode change 100644 => 100755 assets/README.md
mode change 100644 => 100755 assets/css/app.css
mode change 100644 => 100755 assets/js/app-monitor.js
mode change 100644 => 100755 assets/js/app.js`