Using git subtree to export a directory (with its history) from one git repository to another:
git subtree add --prefix=local_directory https://github.com/account_name/other_project_to_commits master
git subtree pull --prefix=local_directory https://github.com/account_name/other_project_to_commits develop
git subtree push --prefix=local_directory https://github.com/account_name/other_project_to_commits develop
If you prefer to avoid repeating the repository URL, then you can add it as a remote:
git remote add -f -t master --no-tags remote_name https://github.com/account_name/other_project_to_commits.git
Examples of remote name and local .git
directory:
git subtree add --squash --prefix=local_directory file:///D:/other_project_to_commits/.git master