If you are ever worried about losing your work due to a broken or lost connection, tmux is a great tool for preserving all of the progress made in any given session. With this tool, you can make sure that nothing gets left behind.
From a open session run:
tmux new -As "session_name"
You can combine it with you SSH command also:
ssh [email protected] -t "tmux new -As session_name"
Replace session_name
with any identifier you want.