TIL: Changing working directory in tmux

I tend to keep a long-lived tmux session per project that I'm working on. When I want to start a new project though, it carries the old working directory with it. I keep forgetting what I need to do to type it, so hopefully this TIL makes me remember it for the next time.

To switch the current working directory, do a :attach -c <newdir>. And to do it it even more easily, I bound it in my tmux configuration to Meta-w:

bind M-w attach -c "#{pane_current_path}"