This is the earliest post-war account I could find of the "pinning the names to the coat" practice from the Battle of Cold Harbor. . . though the action in this case is from the Mine Run Campaign.
THE CRISIS OF MINE RUN
Early on Monday morning the Army was under arms impatiently awaiting tho signal-gun. At last the sound of Sedgwick's cannon came rolling along the line, when the entire artillery of the right and centre opened upon the works of the enemy. But not an echo from WARREN on the left! The explanations of this silence soon came in intelligence brought by an aide-de-camp. A close observation of the enemy's position by dawn revealed a different state of facts than was presented the previous evening. The precence of WARREN'S troops had attracted Lee's attention to his right, and during the night he powerfully strengthened that flank by artillery in position and by infantry behind breastworks and abatis. Looking at the position with the critical eye of an engineer, but not without those lofty inspirations of courage that o'erleap the cold dictates of mathematical calculation, WARREN saw that tho task was hopeless; and so seeing, he resolved to sacrifice himself rather than his command. He assumed the responsibility of suspending the attack.
His verdict was that of his soldiers- a verdict pronounced not in spoken words, but in a circumstance more potent than words and full of a touching pathos.
The time has not been soon when the Army of the Potomac shrank from any call of duty; but an unparalled experience in war, joined to a great intelligence in and file, had taught these men what, by heroic courage, might be done, and what was beyond the bounds human possibility. Recognizing that the task now before them was of the character of a forlorn hope, knowing well that no man could here count on escaping death, the soldiers, without sign of shrinking from the sacrifice, were seen quietly pinning on the breast of their blouses of blue, slips of paper on which each had written his name.
-The United States Army and Navy Journal and Gazette of the Regular Army; April 28, 1866