Ryan Raw, aged 28, butted the boyfriend in the beer garden of a pub.
And when the woman returned home at 3am, she found Raw in the house, where he assaulted her new boyfriend again.
Raw, of Thomas Street, Retford, was jailed for 18 weeks after admitting two charges of assault and one of harassing and pestering the woman on the night of Friday, December 18.
District Judge Leo Pyle also imposed a restraining order on Raw, banning him from making any contact with the victims for one year. or going to her home.
Donna Fawcett, prosecuting at Nottingham Magistrates’ Court, said the victims were out enjoying drinks with a group of friends.
Miss Fawcett said: “Raw hassled them all night, followed them to the same pubs and bars and tried to provoke the man into a fight.
“In the beer garden of one pub, they were sat down when Raw bent down between them and said sarcastically ‘you two make a lovely couple’.
“He then butted the man without any provocation at all.”
The court heard Raw was kicked out of one pub, Yates’s, but when the woman and her boyfriend went back to her house on Thrumpton Lane, Retford, they were shocked to see Raw run downstairs as they opened the door.
Miss Fawcett said: “She had no idea how he’d got in.
“He said he wanted to tell her how much he loved her, but while the boyfriend was standing in the doorway, Raw punched him in the forehead.
“Raw ran out and was then seen on the roof of the house.
“Police were called and he was arrested after he jumped down.”
When interviewed by officers, the court heard, Raw said he did not know the boyfriend, but “was jealous of his relationship with the woman and was confused because he believed she still loved him”.
Andrew Osborne, mitigating, said Raw had been receiving “mixed messages” from the woman, who had visited him while he was in prison for another matter and with whom he had a child.
Mr Osborne said: “He became angry and upset when he thought she was breaching an agreement they had about not seeing anybody else, but he now accepts she can do what she likes.
“A lot of drink was involved on this evening, and it was only a low-powered head-butt.
“The woman told him to go to her address to talk about matters.
“He accepts he aimed a punch on his way out.
“Both assaults were medium to minor.”
Judge Pyle said the offences were aggravated by the criminal record of Raw, who was told he must be supervised by the probation service for 12 months after his release from jail.