These are the steps to extract a directory from a git repository (with all its history commit), create a new repository from this directory, and optionally remove it from the original one.
To the ones that are here to copy-paste code, this is an example which removes the MODULE directory from REPO repository.
Clone the original repository:
git clone https://github.com/mvneves/REPO.git
cd REPO
Extract the directory and put it in a new branch:
git-subtree split --prefix=path/to/MODULE/ --branch=new_branch
cd ..
mkdir MODULE
cd MODULE
git init
git pull ../REPO new_branch
git filter-branch --tree-filter 'rm -rf path/to/MODULE/' --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
echo path/to/MODULE/ >> .gitignore
git add .gitignore
git commit -m 'Removing path/to/MODULE from git history'
git gc
git push origin master --force