The attacking midfielder has agreed a three-and-a-half year deal with the Championship side, who have paid an undisclosed fee.
Stokes will spend the rest of the season at the Shots before heading back to Bristol in the summer. A number of clubs were keen on the teenager, who arrived from AFC Sudbury last year.
Aldershot Tommy Widdrington said. "It's come as no surprise to any of us that Josh - and others - have attracted so much interest considering the season he and we've had so far.”
"It should also come as a stark reminder of what's possible to any player who's faced disappointment at any stage of a fledgling career and act as a motivation to keep at it and believe in yourself.
"There were lots of clubs at all levels keen to acquire Josh's services, but I think Bristol City is a great fit for all parties to continue his football journey."
Stokes has scored 16 goals in 29 appearances this season and that convinced the Robins to make their move.
“Josh is a fantastic talent who will only improve," Bristol City technical director Brian Tinnion said. "We wish him all the best for the remainder of the season with Aldershot and look forward to seeing him in the summer."