function gdt
    if not test -d .git
        echo "Not a git repository"
        return 0
    end

    if count $argv >/dev/null
        git --no-pager difftool $argv
    else
        set default (git symbolic-ref refs/remotes/origin/HEAD | awk -F'/' '{print $4}')
        set current (git branch --show-current)
        git --no-pager difftool $default...$current
    end
end
