'git log a specific file without cloning the entire repo

I have a very large repo due to its long history and I want to get the logs of a certain directory in my git tree without cloning or with cloning the minimum required files. According to https://rukman7.github.io/2020/08/13/Git-history.html I can clone the code only using

git clone --bare --single-branch $GIT_BASE

I tried doing that although I know that's not the optimum scenario in my case (the code is not so large compared to the git repo history). And according to that question Cloning / Reading only history /log of a git repository I can get the log of a specific dir using

git log -1 --pretty='format:%ci' dir/

My issue is when I run that first command I don't get the tree of the files so using the second command returns

fatal: ambiguous argument 'dir/': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Is there a way to run git log without cloning the entire repo?

git


Sources

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

Source: Stack Overflow

Solution Source