Now I could have done something like enabling SSH on my old Mac and transferring files using scp. Or I could have set up an FTP server and transferred files that way. I could have also copied files over to an external disk. None of these methods are particularly elegant and require either additional hardware or software to be installed.
Using target disk mode (TDM) means you can use the USB-C charge cable that came with your Mac to connect both Macs together and easily copy files from one to the other. Enabling TDM is done by first shutting down the Mac you want to copy files from. Then while holding down the T button, power on the Mac.
The Mac will not start macOS, but will start up as if it was an external disk drive. You will see the Thunderbolt symbol on the screen once the Mac you're copying to has connected to it. It may be necessary to enter the HDD password to unlock the source Mac, if you're using an encrypted file system.
The hard drives from the source Mac will appear in the target Mac. Copying files is as simple as dragging them from one to the other. Because the Macs are connected using a USB-C cable, this method will get the fastest transfer speed. In my case copying about 40Gb of data in 4 minutes.