I've got a git repo that I would like to restructure completely.
All in all I've got three features, let's call them feature A, B, C, that I've been working on for the past few weeks. Unfortunately I've been a bit unthoughtful regarding how to use branches to split my working on the features correctly, and I somehow also jumped from feature to feature even between commits. 
So now I've got three branches A_devel, B_devel, C_devel and in each branch a bunch of commits that belong to each of the three features. Some commits of feature A also containing some changes for feature B in B_devel, some of B with changes for A in C_devel and so on. Some commits are even in the master branch, containing changes for any of the features. And all the commits are also already pushed to origin. 
It's a complete chaos...
... that I would like to clean up now.
At least I can see from the commit messages and in some cases just from the code diffs what I've been working on in every particular commit. So I know which commit belongs to which feature. I just need to know how to actually move the commits to the corresponding correct branch.
//edit: by the way, I have to mention that I'm the only one working on this repo, locally as well as on origin. So most likely no one would have problems with a changed history... just in case that's going to be necessary.