Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: get the list of files that have been modified along one specific file

Tags:

git

git-log

I'd like to check which files have been modified at the same time as one specific file. Specifically, I want to get the history of this specific file, and for each commit of this history I want to know which files were affected.

When I do git log --name-only, I get the full history of commits, as well as a list of files that have been modified, for each commit.

Now if I do git log <file>, I get the history of the commits that involved this specific file.

git log --name-only <file>, however, do not include the full list of files modified by each commits. Instead it only shows me <file>, which is quite useless to be honest. Is there any way to make this command include all files?

like image 550
Aratz Avatar asked Nov 05 '25 23:11

Aratz


1 Answers

Use git-rev-list to list commits affecting specific path and then git-show to get all the files modified in each commit:

git show --name-only $(git rev-list HEAD -- PATH)

like image 109
mshrbkv Avatar answered Nov 07 '25 13:11

mshrbkv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!