Once my car is put into gear it starts to shake and miss? on 2002 Nissan Xterra

It only does this when idling at first I thought it was my brakes sticking but its not that my car shakes and acts like its about to shut off.

Asked by for the 2002 Nissan Xterra