Unable to understand the benefit of Zsh's autopushd

pushd is like cd, but it also pushes your current directory onto a stack. You might be in /some/deep/directory and then need to poke around in /var/www for a while:

crb@server /some/deep/directory $ pushd /var/www/
/var/www /some/deep/directory
crb@server /var/www $ [do some stuff]
crb@server /var/www $ popd
/some/deep/directory
crb@server /some/deep/directory $

autopushd means that even if you type 'cd', you get the effect of having typed 'pushd', which you don't remember you wanted to use until you think "man, I really wish I could get back to where I was before". You can then popd your way back through your directory history.

It's useful to know you can always change to the directory you were in before this one (as opposed to the parent directory) by typing 'cd -'.

Here's another good writeup.

Edit Why use pushd when you can use cd - ?

cd /foo/bar
cd /baz
cd /somewhere/else

cd - will only get you up to /baz. pushd will get you all the way back up to where you were before you typed 'cd /foo/bar'.

The directory stack is particularly useful in scripts, where you can't just go back through your command history and recognize the name of the directory you were in:

pushd /var/foo
# run a command, which might well change your PWD at the end of its execution - especially if it fails
popd

You are now guaranteed to be in /var/foo.