Literary critic
Helen Vendler thinks it likely that Whitman wrote the poem before "When Lilacs Last in the Dooryard Bloom'd", considering it a direct response to "Hush'd Be the Camps To-Day". An early draft of the poem is written in free verse.
"My Captain" was first published in
on November 4, 1865. Around the same time, it was included in Whitman's book,
Sequel to Drum-Tapspublication in
The Saturday Press was considered a "
teaser" for the book. Although
Sequel to Drum-Taps was first published in early October 1865, the copies were not ready for distribution until December. The first publication of the poem had different punctuation than Whitman intended, and he corrected before its next publication. It was also included in the 1867 edition of
Leaves of Grass. Whitman revised the poem several times during his life, including in his 1871 collection
Passage to India. Its final republication by Whitman was in the 1881 edition of
Leaves of Grass.