You can use git bisect
to find when something changed in a certain way. It operates off the assumption that the repository was right in the past, but something happened recently to make it not-right.
For this example, "good" is the directory not existing, and "bad" is the directory existing.
First you find a commit where it's "bad":
$ ls -d MyDirectory
MyDirectory/
$ git bisect start
$ git bisect bad
Then you find a commit where it's "good"
$ git checkout HEAD~1000
$ ls -d MyDirectory
ls: cannot access 'MyDirectory': No such file or directory
$ git bisect good
Then you either repeatedly do manual bisect good/bad
:
$ if [ -d MyDirectory ]; then git bisect bad; else git bisect good; fi
Or you use bisect run
:
$ git bisect run [ ! -d MyDirectory ]
At the end it'll tell you the first "bad" commit.