0

I had some issues about pushing a local git repo to an existing remote git repo (Github). Git was complaining about a folder that was missing in my local repository but present in my remote repository, so I wasn't able to push on Github. As I had no idea about how to solve this problem I decided to delete both git repositories (local and remote) -- using How to fully delete a git repository created with init? --, and create a new repository in my project directory to push it on Github.

Then I did git init and git add . and got this message in VS Code : "The git repository at /path has too many active changes, only a subset of Git features will be enabled. Would you like to add 'node_modules' to .gitignore?" -- I did nothing about that.

Then when I enter git status in Terminal I had an unusual / huge amount of files (node_modules again) on stage except my src/pages folder which is displayed in red:

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)
  (commit or discard the untracked or modified content in submodules)

modified:   src/pages (modified content, untracked content)"

So I did git add src/pages and after that I got back to the same problem.

Git also proposed me to use git rm --cached <file> to unstage but I don't know what that does once executed (I mean it doesn't work in my case).

It seems I created a kind of conflict by deleting and recreating my local git repository and I'm unable to figure out how to get things back to normal. I would like to be able to track the content of the src/pages of my App again and then push it on Github. Could anyone explain me what is happening under the hood? Thanks.

Note: I also tried this but it doesn't work for me : How to fix "modified content, untracked content" in git?

LeGEC
  • 46,477
  • 5
  • 57
  • 104
chalatum
  • 67
  • 1
  • 3
  • 9
  • 1
    Your `src/pages` appears to be another Git repository. In your original Git repository, it was probably a *submodule*. Are you using the trick in which your GitHub pages is a submodule of the main repository? If so, do you want to keep using that trick? – torek Jun 28 '20 at 16:02
  • @torek I dont't really know what is the difference between a Git repository and a submodule but I just checked my folder project. There is a .git at the root and another in the src/pages. About the trick you mentioned, at the moment there is no Github repository, I deleted it. For now I am stuck with the fact that I'm unable to commit my src/pages (the main content of my project) so I did not try to recreate a repository on Github. I'm unaware of that kind of trick and don't know the utility. – chalatum Jun 28 '20 at 22:16
  • @torek So I guess I've got to remove the git repository in src/pages? And what about the fact that when I commit there is just all those node_modules on stage? – chalatum Jun 28 '20 at 22:16
  • If src/pages is meant to be a submodule that is a copy of the main repository, you'll need to add it as a separate submodule using `git submodule add`. Each submodule is a Git repository in its own right—it has its own branches and commits. The tricky thing with pages that I have heard of (I have not done it myself) is that you use the same Git repository twice, once as the superproject, and once as the submodule. I have not set this up myself, so I'm not entirely sure what the method is. – torek Jun 29 '20 at 00:17
  • @torek I deleted the submodule in my src/pages and was able to push on github. Thank you for your answers. – chalatum Jun 29 '20 at 19:37

0 Answers0