First, clone your repo so that you can work on it in isolation, and keep your original intact if something goes wrong.
git clone --no-hardlinks c:\workspace\test\src c:\sandbox
write a script that makes the appropriate changes for any commit. I am not familiar with Windows scripts, but you want your script to create a new subdirectory called src (i.e. c:\sandbox\src ) and then move everything except the .git directory and any .git* files (e.g. .gitignore ) to this new subdirectory. Make sure your script will work properly with any commit in the repo, and not just in the current state. Then run:
git filter-branch
This will cause git to check each commit in the repo, run your script, and then replace the commit with the final result. Then, if you have ignored or unfixed files, you will want to copy them to the appropriate places in the new repo. Make sure the filter branch has the intended effect and the new repo looks the way you wanted it to. Once you are sure that you are happy, delete c:\workspace\test , and then move c:\sandbox to c:\workspace\test .
I prefer to use --tree-filter , as shown here, rather than --index-filter . It is less efficient (since it should check every commit, and not edit the index directly), but I find it more intuitive. If necessary, it will also allow you to make changes to the contents of files in the repo (possibly update absolute paths).
source share