Join two windows as panes (Merge window 2 to window 1 as panes)

panes

// what it does

join-pane -s 2 -t 1 takes the pane from window 2 (the source, -s) and splits it into window 1 (the target, -t), merging the two windows' panes into a single view. It's the inverse of break-pane. Run it from the command prompt (Ctrl+b :) to consolidate scattered windows back into one multi-pane window.

// tmux command

: join-pane -s 2 -t 1

// gotcha

-s and -t are pane targets, not just window numbers; "2" resolves to a pane in window 2, and if that window had only that one pane it's destroyed once the pane moves. Add -h or -v to control the split orientation, otherwise you get tmux's default.