This tune is played as a reel for American contra dances, but was originally a hornpipe with the A and B parts reversed from the order found here. It is related to a tune named The Cuckoo's Nest. Jacky Tar is an English term originally used for seamen of the Merchant or Royal Navy. It was not pejorative and sailors used the term themselves.
This tune was first printed in 1903 in America, in policeman and Irish traditional music collector Francis O'Neill's Music of Ireland, which contained 1850 melodies.
This tune is Irish in style but may have originated in the US before its spread through much of the traditional music world. It is also known as a hornpipe named Katherine Brennan's Favorite, which came from Irish-American fiddler Andy McGann, who learned it from his fiddle teacher Katherine Brennan.