Created
August 2, 2011 11:51
-
-
Save sordina/1120049 to your computer and use it in GitHub Desktop.
View all revisions of a git versioned file at once, marked by revision and date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
file="$1" | |
# Date flag | |
if [[ "$file" == "-v" ]] | |
then | |
file="$2" | |
verbose=1 | |
fi | |
export file | |
export verbose | |
if [ "X" == "X$file" ] | |
then | |
echo "Usage: git-history <path>" | |
exit 1 | |
fi | |
function difference_engine() { | |
printf -- "---------- $1:$file\n\n" | |
if [[ "$verbose" ]] | |
then | |
git shortlog "$1" | tail -n 2 | |
printf -- "----------\n\n" | |
fi | |
git --no-pager show "$1:$file" | |
printf "\n\n" | |
} | |
export -f difference_engine | |
cd "`dirname \"$file\"`" && git rev-list --reverse --children --all -- "$file" | sed -e 's/ .*//' | xargs -n 1 -I % bash -c 'difference_engine %' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment