I just did this with QGIS 3.4.0, using the plugin Join Multiple Lines mentioned by tnagel above (installs under Vector menu > Join Multiple Lines). Worked well to join about 60 trail line fragments into about 20 trail lines. The more fragments you have and the larger the area they cover, the less practical this is, as you have to watch the results for problems (tnagel may have had one of the problems I describe).
You select the lines you want to join, click the menu item and it joins them (you can select as many lines as you want, but...), even if the ends are a mile apart, you get a straight line from the end of one to the end of the other connecting them, so make sure your ends are close enough so you will be happy with the results (I used the tip in another post to mark the ends of my lines with markers, so they were easy to see (Properties > Symbology > add a marker line and make the symbol large enough to see easily > select the radio button "on last vertex only" (and if you want, add another marker line with a different symbol and select "on first vertex only")).
Also, lines can apparently be directional. So you have to watch (for example) that the southernmost end of line A did not join with the southernmost end of line B below it (another long straight line where you do not want it).
I found when that happened I could "undo" and use "Reverse line" in the Advanced Processing Toolbar to flip the direction of a line from one end to the other (does not change where the line is, just flips the start of the line with the end of the line), then join the lines again.
A good thing about this is your changes/edits are saved to your existing layer so no need to save the results as a new shapefile (make a backup first).
I am constantly amazed at the work done by QGIS's core and plugin developers. Shows what smart constructive humans can do when they decide to work together. Thank you!