Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find the commit that changed file permissions

Tags:

git

What combination of arguments to git log or similar will find the commit that changed permissions on a file?

I can use git log -p <file> and grep for "new mode", but that doesn't seem very satisfying.

like image 645
gcbenison Avatar asked Mar 23 '23 23:03

gcbenison


1 Answers

My solution use git log --summary and grep

List all commits that the permission of a given file is modified

git log --summary {file} |grep -e ^commit -e"=>"|grep '=>' -B1 | grep ^commit

If {file} is omitted, it will list all commits, where any file's permission is modified.

like image 89
Sungam Avatar answered Apr 11 '23 03:04

Sungam