1

I am very new to git (only two weeks).

I tried searching through other answers but nothing seemed to work, sorry if the answer should be obvious but here goes.

I have several git repos which I decided shouldn't really be separate repos as they were all for the same project.

So I made a new git repo "lpthw" and in the terminal within that repo created another git repo named "P0001". I pulled all the files successfully from the original "P0001" into the new subfolder "P0001".

I changed directories up to "lpthw", add the changes I had made, committed them, and pushed them to github.

When I went to github to check it however the lpthw repo was there, as was the P0001 subfolder, but none of the files within the P0001 subfolder appeared. They are definitely there as I checked in my file viewer.

Am I approaching this in the wrong way? Or have I missed out a step on when you push the subfolder to github to make sure the files go with it?

Any help at all would be appreciated, in the meantime I'll keep pressing on and see what happens.

MoSherman
  • 35
  • 1
  • 1
  • 8

1 Answers1

0

P0001 is just a nested repo within lpthw parent repo: its content will be ignored by the parent repo (actually P001 HEAD would still be tracked as a gitlink).

If you were to remove that folder, and then add it back as a submodule, then lpthw would be able to keep a reference to P001 content

cd /path/to/lpthw 
git submodule add -- https://github.com/user/P001 P001
git add .
git commit -m "add P001 as a submodule"
git push

On GitHub, you would still only see P001 folder (empty), but that would be a gray folder, meaning a gitlink, a special entry in lpthw index.

Any git clone --recursive https://github.com/user/lpthw would clone P001 as well, at the right SHA1.

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