Mark Davidson, 46, said he saw David Nairne “stick the head” on bank worker Alan Ross in Mathers Bar, Edinburgh.
The alleged attack happened eight months before the charred body of 45-year-old IT expert Mr Ross was found in his smoke-filled flat.
Nairne, 26, a prisoner at Edinburgh, is on trial at the High Court in Livingston for allegedly murdering Mr. Ross in February this year. He denies the charge.
He has pled not guilty to attempting to defeat the ends of justice by setting fire to the dead man’s clothing, trying to make the fire spread faster and disposing of evidence, including the murder weapon.
He also denies assaulting Mr Ross in the pub in Broughton Street in June last year.
Mr Davidson said Mr Ross and Nairne were both part of a group of regular customers at Mathers Bar.
On the evening of the assault there had been some teasing and banter about Mr Ross being gay.
He said Mr Ross had retaliated by making a remark about Nairne’s then girlfriend.
Nairne reacted by head butting him on the bridge of his nose causing it to start bleeding.
Mr Davidson told the jury: “I and my nephew Ross Davidson, who normally works in the bar, escorted David out of the bar to the street to make sure there was no further incident.
“He was very angry and aggressive. He looked as if he was waiting for Alan to come out.
“I told him he was barred and said I would call the police if he didn’t leave.”
He and his nephew both identified Nairne as the attacker.
Earlier the court heard evidence that Mr Ross had boasted to friends that he had “slept” with the man now accused of his murder.
He told pals that he had been “in a relationship” with 26-year-old David Nairne for several months.
The trial continues.