A man who attacked his girlfriend at a McDonald's restaurant in western Sydney before fleeing the scene in her car has been sentenced to six years in jail.