Combining git repositories

Prior to this semester, I had been keeping my code for every class in a separate repository. This semester, I realized that adding another 4-5 repos to my GitHub every term was probably a bad idea. I wanted to consolidate them all into a single git repo. The only issue? I didn’t know how to combine the repos and keep the commit history for all of them separate repos. Since my GitHub activity consists almost entirely of commits on schoolwork, I didn’t want that to disappear when I deleted the old individual repos.