Created
February 20, 2014 09:15
-
-
Save nickshanks/9109780 to your computer and use it in GitHub Desktop.
Prints out a list of hashes from the master branch and their distance from the current HEAD. This is useful for finding the fork point of a tree dump you may have received via email or similar. Relies on the porcelain command diff-tree so expect it to break in future.
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 | |
HASHES=$(git rev-list master) | |
HASHES=($HASHES) | |
for HASH in "${HASHES[@]}" | |
do | |
STATS=($(git diff-tree --minimal --shortstat -w HEAD $HASH)) | |
echo "$HASH => ${STATS[0]} files changed, $((${STATS[3]}+${STATS[5]})) lines changed (+${STATS[3]}/-${STATS[5]})" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment