moomou

(ノ≧∇≦)ノ ミ ┸┸

Navigating within a Mono Repo

Posted at — Dec 29, 2025

Groot and Friends #

Navigating within a mono repo can be tedious.

I frequently find myself doing cd ../.. to navigate to sibling folders or jumping to the root of the git directory to navigate and inspect other part of the code base.

To navigate to the root of the Git repository, I use an alias groot defined as

    alias groot='cd $(git rev-parse --show-toplevel)'

Excellent tools such as fd and fzf help a lot but I want to be able to jump to different part of the repo with a few keystrokes. For example, in a mono repo, I want to be quickly jump from go/src/mou.dev/cmd to schema/proto.

   $ cd mono
   $ tree
   .
   ├── README.md
   ├── TODO.md
   ├── conf
   ├── data
   ├── datagen
   ├── git_push_origin.sh
   ├── go
   │    ├── src
   │        └── mou.dev
   │            └── cmd (CURRENTLY HERE)
   ├── ts
   └── schema
       └── proto

To solve this problem for myself, I built gd, a simple bash script that allows contextual directory navigation within a git repository.

Inside each git repo, gd saves a mapping between a user defined key and a destination directory in .gd files. When one runs gd proto, gd recursively looks up for a .gd from current directory up to the git root to find proto=<DST> mapping and navigate to the <DST>.

I have been using gd for about a year now and I have lost count of keystrokes it has saved me!

You can find gd at https://github.com/moomou/gd

PS: I am aware that newer shells like fish and zsh have fancier directory navigation support but bash is EVERYWHERE and my preferred shell.