Shmurda, has been jailed since December 2014 in a case where more than 15 defendants were charged with various crimes, including murder, attempted murder and drug dealing.
The rapper was originally charged with conspiracy to commit murder and several weapons and drug charges associated with gangs.
According to the deal, Shmurda pled to conspiracy to possess weapons and possession of a weapon. The other charges were dismissed, and he'll get 7 years in prison and 5 years probation.
The semi-good news, Bobby's been behind bars for 20 months ... so he'll get credit for that.
A TMZ producer was in court, and heard Shmurda's lawyer speak with his client and other defendants, imploring them to take the deal because they'd never get a sympathetic jury and they were facing life in prison.
Shmurda's case became a cause celebre, where other rappers were calling for his release.