0

I'm working on a thesis and need to paste all my code from the project into the appendix of the paper. The code is currently stored in a git repository. Is there an easy way to do this without copying and pasting the code from every single file in the repository into individual code blocks?

Alex Cohen
  • 5,596
  • 16
  • 54
  • 104

1 Answers1

1

It is best to include only a link, or, with Latex, a gitinfo2 tag (a precise reference to a commit)

You would then only copy-paste in your annex only the relevant extract of your Git repo code.

But if you must, you can transform a source code into an html with syntax highlighting colors using ansi2html.
And then for each file, convert it to a word document with pandoc

You can apply that to the list of files in your repository:

git ls-tree -r master --name-only
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250