Skip to content

Instantly share code, notes, and snippets.

@chrismccoy
chrismccoy / gitcheats.txt
Last active August 9, 2023 20:55
git cheats
View gitcheats.txt
# 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
git rev-list --all | while read h; do git archive --format zip -o $h.zip $h; done
# zip up an archive of each commit with number of commit added to hash