When attempting to attach to a new tmux from within a tmux session an error is shown:
sessions should be nested with care, unset $TMUX to force
Why sessions shouldn't be nested is understandable but it makes jumping between tmux sessions annoying as you need to detach manually then re-attach to a new session.
Is it possible to create a command which detaches from the current tmux session and attaches onto the given one without resorting to unsetting $TMUX?
alias tm="tmux detach; tmux new -A -s" however this doesn't work which isn't surprising as
tmux new -A -s is run the shell I just detached from not the shell I am returning to.