Andrew Ralston, 30, threatened to kill William Crichton as he attacked him outside his home leaving him screaming out in pain.
At the High Court in Edinburgh yesterday, judge Lady Scott told Ralston: "It became a nasty and sustained assault on a vulnerable man who was lying defenceless on the ground.
"It involved 15 or more repeated blows to the victim's head, limbs and body with a stick."
The judge said she also had to take into account the fact Ralston had a previous conviction for culpable homicide which resulted in him being sentenced to four years in 2001.
Ralston had earlier admitted assaulting Mr Crichton at Hawick Crescent, Larkhall, Lanarkshire, to his severe injury and permanent disfigurement on December 18 last year.
Mr Crichton had noticed Ralston's dog fouling in his garden. He confronted Ralston, who took the stick from his victim and started to attack him.
The court heard Mr Crichton believed he was unconscious for a short period during the attack.
His partner repeatedly screamed at Ralston to stop, and saw blood pouring from Mr Crichton's head as the attack continued.
Mr Crichton was taken to Wishaw General Hospital with a fractured arm and head wounds.