Home > Software design >  How to print out each version of a given file in "git log"?
How to print out each version of a given file in "git log"?

Time:07-24

We can generate a patch for each version of a given file by:

git log -p -- <filename>

But it only shows the diff of each version, I want it to show the full content of the file at each version, so I can next parse the output as my demand. Does git log support this?

CodePudding user response:

Quickest hack I can think of is to parse fast-export output, it's not hard,

git fast-export --all -- path/to/file

and if you're using commit signing or tagging objects other than commits you'll need to add some options to filter those out.

  • Related