Skip to content

Instantly share code, notes, and snippets.

@ericksli
Last active August 29, 2015 14:09
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 ericksli/474ca1ecd4154a5304e7 to your computer and use it in GitHub Desktop.
Save ericksli/474ca1ecd4154a5304e7 to your computer and use it in GitHub Desktop.
List all files with version hash in a Git repository
#!/bin/bash
# Usage: Git checkout to the commit you want, then run this script to print the files in the repository and its version hash.
files="`git ls-files`"
while read -r filename; do
hash="`git log -1 --pretty=%h ${filename}`"
echo -e "$filename\t$hash"
done <<< "$files"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment