This simple shell snippet has saved me countless keystrokes and mental context switches. It works on the assumption that most tasks are based in or around a single directory such as a Git working tree.

s() {
        pwd > ~/.saved_dir
}

i() {
        cd "$(cat ~/.saved_dir)"
}

I typically use it like this:

$ cd /srv/long/path/that/is/tricky/to/autocomplete
$ ls
one   two   three
$ s

(Switch to another terminal tab or GNU Screen window, etc.)

$ pwd
/home/lamby
$ i
$ pwd
/srv/long/path/that/is/tricky/to/autocomplete
$ ls
one   two   three

This saves me having to navigate—or even think about navigating—to the deeply nested directory.