Howto split a git repository into two

Sometimes you’ll want or have to split a git repository into two. This is
usually a sign of not thinking forward enough but hey sh.. happens.
If your repository is structured in a way that you just need a subdirectory
of it into a new repository you can follow the steps below.

We assume a repository foo that contains a folder foobar that shall
be a new repository called bar.