Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git list changed files in several commits

Tags:

git

I want to get all files that are changed in commits that matched some conditions. So I have following: git log --grep=123, and I need to get files that are changed in that commits as an aggregated list, e.g. if file is changed in several commits it should be included only once in the resulting list. That is like selecting several commits in tortoise svn log window, it lists all files that are changed in the selected commits

like image 314
michael nesterenko Avatar asked Feb 16 '12 16:02

michael nesterenko


2 Answers

git log shouldn't be used for scripting, but here's a quick solution:

git log --grep=pattern --name-only --pretty=format:'' | sort -u
like image 178
knittl Avatar answered Nov 08 '22 00:11

knittl


Not exactly the answer but if your condition is position of start and end of consistent commits series git is ready to help:

git diff --name-only <SHA, tag start> <SHA, tag end>

like image 39
I159 Avatar answered Nov 07 '22 23:11

I159