In my current work company, we have our code checked out in different location.

Let’s assume we have:


I often find myself jumping around a lot between these directories. One could use a tool like z or similar. But I have found it very helpful to just define local envvars for these locations. Coming back to the example above, I’d have something like:

G=/home/me/src/personal_checkout # G for 'git'

I can now just cd $S or cd $D to go to where I want. More importantly, this allows you to quickly test different version of your code:

$ $S/scriptA # has a bug
$ $D/scriptA # still has a bug
$ $G/scriptA # fixed in my local checkout

Running the above 3 commands is very easy because one just needs to exchange the environment variable in the previous command. Using readline in vi mode, you’d only press <Esc>k0lrD<Enter> to run the development version of the same executable. (The keystrokes sequence looks longer than it is - it’ll take 1-2secs to rerun; still faster than your peers!)

Another advantage of these environment variables is that you don’t have to change your current working directory. You can just run things from where you are already.