This one is thought to have originated in the early 19th century as a Negro spiritual and camp meeting song. In the early 20th century it was adapted as a labor union protest song and later as a civil rights anthem. It has appeared in many hymnals with various words and arrangements copyrighted by the publishers.
The lyrics are based on scriptures including
Blessed is the man that trusteth in the Lord, and whose hope the Lord is. For he shall be as a tree planted by the water . . . .Jeremiah 17:7
And he shall be like a tree planted by the rivers of water, that bringeth forth his fruit in his season; his leaf also shall not wither; and whatsoever he doeth shall prosper. Psalm 1:3