This song tells the whimsical story of a goatherd whose yodelling is heard from far off and by passers-by, until he falls in love with a girl who wears a pale-pink coat, with her mother joining in the yodelling. The original 1959 musical has this as the song Maria sings to comfort the Von Trapp children during a storm. For the 1965 film adaptation, screenwriter Ernest Lehman repositioned this song to a later part of the film wherein Maria and the children sing it as part of a marionette show they perform for their father. The song in place of "The Lonely Goatherd" was "My Favorite Things", which was originally sung earlier in the original musical at the office of the Mother Abbess as a duet between her and Maria, just before she gets sent to serve Captain von Trapp's family as governess to his seven children. While many stage productions retain the original order as used in the 1959 musical, many other productions have also adapted the changes made in the film, shifting "The Lonely Goatherd" to another scene and adding "My Favorite Things" in its place. In the 1981 West End revival with Petula Clark, Maria and the children sing it at a fair, and in the 1998 Broadway revival with Rebecca Luker it is sung at the Salzburg Festival concert, replacing what would have been an intricate Bach-sounding reprise of "Do Re Mi", showing how exemplary the Von Trapp children were at singing difficult choral compositions. Here, the vocal arrangements were by Jeanine Tesori, giving the audience an idea of how versatile they were. In the 2013 NBC broadcast of The Sound of Music Live!, it was once again used as it was in the original 1959 production. The lively number reappears later in both the original stage version, the film version and the 2013 NBC special broadcast as a deliberately paced and very Austrian-sounding instrumental, the Ländler, a dance performed by the Captain and Maria. It then serves as the catalyst to a dramatic juncture in the film, as the young novice Maria realizes that she is in love with the Captain. The famous marionette puppetry sequence in the film was produced and performed by the leading puppeteers of the day, Bil Baird and Cora Eisenberg. According to The Sound of Music Companion, Hammerstein had come up with several phrases to rhyme with the word goatherd, such as "remote heard", "throat heard", "moat heard", etc. to add enjoyment to the song.
performed this song with The Muppets as the opening number to her guest appearance on The Muppet Show in 1977. In The Story of Tracy Beaker episode "Miss You" from Series 1, Mike is reminiscing about good times with his guitar. We later see him fantasising about taking the Dumping Ground kids camping and in this fantasy we see him singing/playing The Lonely Goatherd. In the Werewolf episode of Mystery Science Theater 3000, Mike Nelson briefly sings the first few lines of the song during the movie's end credits. In 2006 Gwen Stefani sampled the song in "Wind It Up" on her album The Sweet Escape. The song was also used briefly in a special Shrek short/Thriller music video featured on the Nintendo 3DS, and was remixed for the credits. The song is frequently performed by The von Trapps, the real life great-grandchildren of the Captain and Maria, and appears on their album, Dream a Little Dream, released on March 4, 2014. Randy Rainbow posted a parody of the song about U.S. presidential candidateHillary Clinton, titled "" on YouTube on October 26, 2016. Sandy and Richard Riccardi posted a parody of this song, about President Donald Trump, titled "" on YouTube on September 26, 2017. Slovenian avant-garde music groupLaibach released a cover of "The Lonely Goatherd" as part of their 2018 The Sound of Music album, featuring guest vocals performed by Boris Benko from Silence.