He also admitted resisting police officers and struggling with them at the same address on July 31, 2020.
Murray Aitken, defence solicitor, said Cochrane, 46 Gairdoch Street, Bainsford, had “knuckled down” and got himself a job, but still had a difficulty with alcohol.
The court heard Cochrane had in fact breached his bail conditions the day after they were put in place – police arrived at the woman’s home and found him hiding in a cupboard.
Sheriff Simon Collins QC said: “He is told not to have contact with her and within 24 hours he has gone and done just that.”
He placed Cochrane on a supervised community payback order for 12 months and told him to complete 145 hours unpaid work in that time.