1

i want to get a list of files from my git repo in JSON format. Have you got any ideas how to do this?

  • Possible duplicate of [Use Javascript to get the list of a user's Github repositories](http://stackoverflow.com/questions/11850527/use-javascript-to-get-the-list-of-a-users-github-repositories) – Dez Oct 14 '16 at 12:03
  • Possible duplicate of [Get all file names from a Github repo through the Github API](http://stackoverflow.com/questions/25022016/get-all-file-names-from-a-github-repo-through-the-github-api) – cassiomolin Oct 14 '16 at 12:12

1 Answers1

1

Not exactly sure what you're looking for but

$ git ls-files | jq -MRn '[inputs]' 

will generate a JSON array with whatever git ls-files returns e.g.

[
  ".gitignore",
  ".gitmodules",
  ".travis.yml",
  "AUTHORS",
  "COPYING",
  "ChangeLog",
  "Dockerfile"
]
jq170727
  • 13,159
  • 3
  • 46
  • 56