#特定のファイルの変更経歴を表示
function git_show_history_of_file(){
[ "$1" == "" ] && echo "give a file name" && return;
[ ! -f "$1" ] && echo "give a file name that exsists" && return;
git log --follow -p "$1"
}
#特定のハッシュの時点で行われた変更点を表示
function git_show_change_made_by_hash(){
[ "$1" == "" ] && echo "give a sha hash, usually 40 bytes, made from 0-9 and a
-f " && return;
git rev-list "HEAD..$1" 2>/dev/null
[ $? -ne 0 ] && {
echo "Hash [$1] does not exsist. Specify a valid commit.";
echo "Possible canidates are..."
git log |grep "${1:0:8}";
[ $? -ne 0 ] && {
{ git log |grep "${1:0:5}"; } || { [ ${#B} -gt 5 ] && git log |grep "${1:0-5:5}"; }
[ $? -ne 0 ] && {
echo "Unable to find any match. Is that really a sha hash of a commit?"
}
}
return 1;
}
git show "$1";
}