0

I'm trying to export the file names of the files that were changed through commits in git to a txt file. How can I approach this problem? I just want the file name and I would like one file name on each line instead of all of them clumped together. Thank you in advance for the help!

Brian Lee
  • 25
  • 1

2 Answers2

3

Update: shorter / simpler version (no need for log -1 here when you have show)

git show --pretty="" --name-only <commitHash> > file.txt

Original answer

git log --name-only <commitHash> -1 --pretty=format:'' > file.txt

will list the related files for any given commit, and print the list, one file per line, in file.txt. (doc)

Note that you could also filter the type of operation relevant for the listing here. I mean, you could list only modified files, or deleted files, for example.

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
-3

Thanks for correction by RomainValeri. My command just made a little modification, it shows file names by date order:

git log -1 --date-order  --name-only  --pretty=format:'' > myAllCommittedFiles.txt
muhammad tayyab
  • 727
  • 7
  • 18