I have a branch in a git repo. How can I find the single commit in the repo that most closely matches the branch? Like if I run a diff, between this branch and every other commit in the repo, I want to find the commit that produces the least amount of diff lines.
How can I find the git commit in a repo that is more similar to a specified branch?
git
This was my solution:#!/bin/shstart_date=2012-03-01end_date=2012-06-01needle_ref=aaaecho  > /tmp/script.out;shas=$(git log --oneline --all --after=$start_date --until=$end_date | cut -d' ' -f 1)for sha in $shasdo    wc=$(git diff --name-only $needle_ref $sha | wc -l)    wc=$(printf %04d $wc);    echo $wc $sha >> /tmp/script.outdonecat /tmp/script.out | grep -v ^$ | sort | head -1 | cut -d' ' -f 2