If anyone says:
Astaghfirullah-alladhi la ilaha illa Huwal-Haiyul-Qayyoomu, wa atubu ilaihi (I seek forgiveness of Allah besides Whom there is non worthy of worship, the Ever-Living, the Self-Subsisting, and I turn to Him in repentance)
his sins will be forgiven even if he should have run away from the battlefield.
In another narration, these words are to be repeated three times.
[Abu Dawud, At-Tirmidhi and Al-Hakim]