I use Fish shell. Sometimes, I find myself in a child directory of a child directory of a child directory, several layers deep, and I want to return to the closest parent with a .git
directory, as this directory represents the root project directory, so to speak.
For example, let's say I have this layout:
./
└── countries/
├── .git/
└── regions/
└── cities/
Whethere I am in countries/
or countries/regions/
or countries/regions/cities/
, I would like this command to change directory to countries/
, because it is the directory that contains .git
.
How do I do this in Fish?