Man sentenced to 5 years in prison for attacking officer with tree branch