1

I developed a web project and tracked it with git. Later I had to use that project in another big project which is again tracked by git. Earlier I didn't have knowledge about git sub module. So I straight away copied the small project folder into the big project folder.

Then when i pushed the big project to the remote repository, I noticed that the remote repo is linking the small project to its respective remote repo. If I change any thing in the small project within the big project, it is not getting tracked. I thought the problem is the .git folder in the small project, so I deleted that folder. Now I can't even push to the small project's remote repo. Is there any solution for this? Can I undo everything I have done so that I can make the small project to be the git sub module of the big project?

Thishani Lucas
  • 550
  • 1
  • 3
  • 21
  • 3
    By deleting the `.git` folder, you deleted everything Git needed to manage that repository. So you effectively destroyed that repository. You will have to clone it again. And yeah, there is nothing stopping you from introducing your inner repository as a submodule later. – poke Jun 17 '16 at 06:37

1 Answers1

3

If I change any thing in the small project within the big project, it is not getting tracked.

It is not being tracked because it was seen by the parent project as a gitlink for nested repo. That is, just a SHA1, not its actual content.

If your first repo was pushed somewhere remote, then you could add it as submodule of your main repo with git submodule add.

cd second/big/repo
git submodule add -- /url/first/repo

If not, you would need to recreate your first repo (outside the big repo), push it somewhere remote (GitHub, GitLab, Bitbucket, ...) and add it as submodule of your big repo.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250