Skip to content

Instantly share code, notes, and snippets.

@nickshanks
Created February 20, 2014 09:15
Show Gist options
  • Select an option

  • Save nickshanks/9109780 to your computer and use it in GitHub Desktop.

Select an option

Save nickshanks/9109780 to your computer and use it in GitHub Desktop.

Revisions

  1. nickshanks created this gist Feb 20, 2014.
    9 changes: 9 additions & 0 deletions git-closest-tree.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/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