'How to access commit hash instead of temp file path in git diff tool script

I have the following configuration for git difftool:

[diff]
    tool = any
[difftool]
    prompt = false
[difftool "any"]
    cmd = /maxkoretskyi/test/my.sh "$LOCAL" "$REMOTE"

inside cmd I have access to several variables like $LOCAL and $REMOTE that I pass to my.sh. Those are temp file paths and my script outputs them simply like this echo "$1" "$2":

$ git difftool git difftool 821d1b06 73a14711
Temp/NviQKc_f1.txt 
Temp/exkQKc_f1.txt

Is there any way to access the commit hashes in my.sh that a user passes to `git difftool command?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source