I started my main project with CVS in 2006, I moved to Subversion in 2008 and I moved to Git in 2021 but at the very beginning, I was a newbie in version control and my repository is messy, several distinct implementations of my game.
I would like to move them into separate branches but I don't want to lose the history between branches, i.e I would like to be able to find in the log that some files were initially in the "master" branch but were moved into the "pre-alpha" branch. How can I achieve that? Should I create a branch, switch to it, remove the files that have nothing to do in it, go back to the "master" branch and remove the files already in the new branch? Is it the proper way of using Git for this purpose?
P.S: I did this based on larsks' answer:
git subtree split -b prealpha --prefix trunk
git subtree split -b alpha --prefix alpha
git subtree split -b jme --prefix tuer
git push origin prealpha
git push origin alpha
git push origin jme
git subtree split -b prebeta --prefix pre_beta
git branch -m master oldmaster
git branch -m prebeta master
git push origin oldmaster
Only this last line doesn't work:
git push origin master
! [rejected] master -> master (non-fast-forward) error: impossible to push the references to 'https://gouessej@git.code.sf.net/p/tuer/git'