A man who attacked his uncle with a shovel has been spared jail.