Unpaid labour for man who hit ex-partner.
Ian Todd, 35, of North Street in Lockwood, hit Julia Thornton outside a Huddersfield town centre pub in the summer.
He admitted the offence on the day a trial was due to take place at Huddersfield Magistrates' Court.
The couple have since split up and Todd has a new partner who is expecting a baby this July.
Dave Mackay, prosecuting, said Todd and Miss Thornton had been in a pub on July 23 and then argued outside.
He then hit her once on the jaw, leaving her with bruising.
Andrew Sugden, defending, said the couple's relationship had been volatile.
"He should have walked away and not let his emotions get the better of him," said Mr Sugden. "He should not have reacted as he did.
"His current partner has created a stable relationship with him and a baby is expected in July."
He said Todd was due to start an electrical engineering course in the New Year with the final aim of becoming en electrician in a year.
Todd was given a Community Order for 12 months which includes 80 hours' unpaid work.
He must also pay pounds 50 compensation to Miss Thornton and pounds 100 towards prosecution costs.