How to move a directory as a git submodule

Create a git repo using the directory content.

Delete the directory content from the original repo (if existing in current git repo being used)

Now add this newly created repo as a submodule.

git submodule add <git-repo-link>

Eg.

git submodule add github.com/jsbisht/project-data.git