Daniel Kingham assaulted his neighbour on March 3, 2019, after the man accompanied Kingham's former girlfriend to a mental health meeting, prosecutor Ian West said.
Kingham texted the man, clearly agitated that he was spending time with the woman.
As he was closing his door Kingham barged his way in and began punching him.
Kingham went away and then returned and threatened to "stab him up."
HIs victim received multiple injuries including a one cm cut to his forehead, severe swelling to his left eye, grazing, cuts and bruising to face, chest, and ribs, as well as a fractured sternum.
Kingham told police his victim was the aggressor.
In a statement, his victim said: "Since the assault I have been in so much pain. I am an alcoholic and have been drinking beer to manage my pain."
"He finds it difficult to leave the house and has to take alcohol before he does so," said Mr West. "He would like compensation."
The court heard Kingham has 17 convictions, most for motoring or breaches of court, but also including common assault in 2005, threatening behaviour in 2010 and GBH in 2013, for which he received a 26 month sentence.
His last conviction was in 2015.
Edward Moss, mitigating, said Kingham had mental health issues, and problems with alcohol and drugs, as well as periods of homelessness.
"He has been diagnosed with depression and agoraphobia,” he said. "He says he is remorseful. He readily accepts he completely overreacted. He has been teetotal for four or five years.”
Kingham, 31, of Underwood Avenue, Barnsley, pleaded guilty to grievous bodily harm without intent.
Judge Peter Kelson QC told him: "Whatever was in your mind the bottom line is simply that your neighbour had done nothing wrong and you lost your temper.
"You set about a sustained assault and then you threatened to stab him."
A restraining order was imposed until further order. If Kingham breaches it he could face a prison sentence of five years.
"This was a gratuitous, sustained and very violent attack," said the judge. He sentenced Kingham to 12 months in prison.