Submodule: my files are gone after committing them and switching branches. Can I get them back?

I committed a repo where I used a PHP template from another repo I found on GitHub. I had to quickly commit my progress and move to another branch to continue work there and so I did.

A week or two later, I came back to this branch and it appears I have missed the fact, that I have committed a repo within a repo, causing the folder to appear on the GitLab UI with this little tiny orange folder
image
and Git icon right next to it. I found out that this means a submodule, which led me to the conclusion that I have done just the above described (I did not notice I could have had a nested repo inside my main repository until I read about submodules).

Now that I am back to this branch, I do not see any files on it. Clicking on the orange folder does not lead to anywhere. I have no idea what happened to my files, what I am sure though, is that I can see my commits via git log, but once I click on them, it looks as if I have not committed any files, just this weird orange folder, that I cannot open, but just click on it without it showing any contents.

Are my files lost forever? Why were the commits possible at all, if so? Where have those files gone?

What I want in the end is to just have my files back in this directory, without any nested git repositories, just the global one containing all the folders.

interesting i will look into how to do that for you and thanks for the idea to do something

I reverted my old commits via right click and checking the Local History.

@ENDERXCODEING , I’ve checked your previous comments, they have been consistently inappropriate and downright offensive, just like the one posted here, so you’ve been reported.

wait what?

can i have a example i have no idea what i have done

what i ment was i wanted to help you find the problem when I said

interesting i will look into how to do that for you and thanks for the idea to do something

i just like to have stuff to do

@bitgetter Sorry that you feel that way. @ENDERXCODEING has been starting to engage in our community, and they have offered to look into questions as challenges to learn.

We welcome and encourage everyone to help each other in a friendly and welcoming environment. Offering help is very much appreciated, and I don’t think that Ender did something wrong here.

1 Like