Git repository of subfolder
===

I have a project which has a repository.
I have the root folder of the repo,

    /A
      /A1
      /A2
    /B
      /B1

I want to seperate the A folder into a different repository, then I want another repository, which looks exactly the same as the one described above, but with instead of folder A, I want folder A to be a submodule of the repository which I just created. So that A is an independent project, and the other repo depends on submodule A, but also contains B.

How should I do that? Or do I have to create a whole new project with losing all commits?

Thanks already!