Skip to content

Instantly share code, notes, and snippets.

@grantjenks
Created November 21, 2023 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grantjenks/62d45d1f279effe85c52cd7a6c57d113 to your computer and use it in GitHub Desktop.
Save grantjenks/62d45d1f279effe85c52cd7a6c57d113 to your computer and use it in GitHub Desktop.
Print all the files tracked by Git
#!/usr/bin/env python
import subprocess
from pathlib import Path
output = subprocess.run(['git', 'ls-files'], stdout=subprocess.PIPE, text=True, check=True)
paths = [Path(path) for path in output.stdout.strip().split('\n')]
for path in paths:
print(path)
print('----')
print(path.read_text())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment