Github move files

Hey!

So, I just learned learned the basics of git & github.

I’m using vscode. So when I want to sync a project, I initialize the repository (in source control in the left panel).
And then in the command Pallete I “add remote from GithuB”
From there I paste the link from the repository which I created in github, e.g. https://github.com/PixelPete36/FCC.git
After that I name it, then sync it, and the files are uploaded to that repository.

The problem is… Within the FCC repository I created a folder called “Markdown Previewer”. And then when I move the files whicch were uploaded from VScode into there, then it messes with my VS code because it doesn’t know where the files went and it makes my Source Control panel on the left go so buggy and say there’s 10,000 things to update. Likely because it thinks they’re gone.

I’d like to put all the projects in their own separate folder, inside one repository. So then I don’t have a repository for every single project… But I’m having a lot of issues putting things into folders after I have connected the git to github…

I tried creating the folder in the repository ahead of time, and then in the https://github.com/PixelPete36/FCC.git link , after FCC I added /Markdown Previewer, hoping that it would just add the files to the folder I created… But it throws an error and seems to only let sync the main repository location e.g. FCC…

I hope this made sense. I’ve been googling this issue for hours… I might just have to make separate repositories for each little project. But yeah, was hoping not to and just organize them all inside one repository.

Let me try to summarize this:

  1. You have git repository, in which new folder is created.
  2. Some files, already in the repository, are moved to the new folder.
  3. Git shows multiple changes to the (moved) files.

Is that correct?

Yes, your summary is correct!

That’s kind of expected then. After moving files, they need to be staged and committed again as the location changed.

10000 files is a bit much though. Did perhaps node_modules directory stopped being ignored by git in the changed location?

I think that has to be the reason. I wonder how I make it continue to recognize the .gitignore file after it has been moved.

.gitignore surely is recognized, but it might not have pattern for node_modules, that apply for directory that’s nested inside another directory.

You can try using different patterns in .gitignore, from what I’m finding, just node_modules, without any additional characters should work. You might consider also having separate .gitignore file for each project.

I’ll try this! Thank you!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.