0

My project(git project) is based on several git projects maintained by others, and I think git's submodule will make it better. (may be other git functions?)

I commit all their updates to my projects, that is to say, I clone their projects to my sub folder instead of a submodule, and fetch their projects sometimes and then commit it to my projects, because I need their latest version.

After that, my git projects contains lots of boring things esp. when I diff the head. These days I learnt some git basic skills, realize it should be a submodule. But My project is already here. I want to reorganize my project. But I can't tell a best practice to do this task with a smallest cost.

Main problem is that I don't want to lose the commit messages in my projects or rebuild my git project from init point. Also, the project's update message is extract from commit.

A best procedure about this?

Maybe just the contrary procudure of this? un-submodule a git submodule

Community
  • 1
  • 1
chao787
  • 1,760
  • 3
  • 18
  • 20

1 Answers1

0

The basic procedure would be to remove the existing subprojects and then add them as submodules. As simple as:

git rm -r mySubproject
git submodule add <repository> mySubproject
git add .gitmodules mySubproject
git commit -m 'mySubproject as a submodule'
GoZoner
  • 67,920
  • 20
  • 95
  • 145