Home > Software design >  List all files touched by commits in git
List all files touched by commits in git

Time:12-18

How to list all the files that were "touched" somewhere between two commits? I am looking for a command similar to git diff COMMIT1..COMMIT2 --name-only but including the files that were modified and reverted later.

For example, let's say I have a repository with a series of commits (linear history): C0->C1->C2->C3->C4. The commit C1 introduced a new file F and then the commit C3 removed it from the repository. I am looking for a command that, given C0 and C4, would tell me that somewhere in between there was a file F. Even though there is no such file in C0 and in C4. Therefore git diff wouldn't mention file F at all.

CodePudding user response:

git diff ref1 ref2 takes into account only given commits, yes, but git log will find the missing steps and list files for each one, which sort will aggregate :

git log --pretty=format:"" --name-only COMMIT1..COMMIT2 | sort -u

CodePudding user response:

try git log to find the missing steps maybe git log --pretty=format:"" --name-only commit1..commit2 | sort -u

  •  Tags:  
  • git
  • Related