Q:

Which commit made a file executable

I have an executable file in a git repository.
How do I find out which commit made that file executable?
I tried git log file.txt but that does not show changes in file modes and searching man pages and google was fruitless.

A:

Use:
git log -p file.txt | grep --before-context 7 "old mode"

(If your commit text is multiple lines long, increase the before context line option so it includes the commit ID)
The file mode change include "old mode" and "new mode" in the log, which is how this works.

