Skip to content

Instantly share code, notes, and snippets.

@chrismccoy
chrismccoy / gitcheats.txt
Last active January 19, 2024 22:17
git cheats
View gitcheats.txt
# clone all your repos with gh cli tool
gh repo list --json name -q '.[].name' | xargs -n1 gh repo clone
# List all files in a folder in a git repository by last commit date
git ls-tree --name-only HEAD | while read filename; do echo "$(git log -1 --format="%ci " -- $filename) $filename"; done | sort -r
# zip up an archive of each commit
for i in `git log --format=%H`; do git archive $i --format=zip -o $i.zip; done
# zip up an archive of each commit