In climbing, a double fisherman's knot is used to tie together two separate pieces of rope.
How would I tie such a knot?
Double fisherman's knot
This is covered extremly well on Animated knots by grog:
Overlap the two ends. Wrap one end around both ropes two full turns. Then pass this end back through these turns and pull tight. Next pass the other end two full turns around both ropes. Pass this end back through and pull tight. Pull on both ropes to tighten the two knots against each other.
The best answer to this might be - don't.
A double fishermans is very strong and secure, but it has serious downsides. The main being that the knot can become impossible to undo if the rope gets wet and strongly loaded, but also the knot can get caught over an edge.
At a course a few years ago (run by the MLTA) I was taught that a simple overhand can be used. It is simpler, easy to untie and less likely to jam when pulling over an edge.
See "Euro Death-Knot" Testing for the safety information about the flat overhand bend and related knots. Never use a flat figure-8 bend in a critical application.