gitvisual-studio-coderepository

How can I commit both my frontend and backend folders to github as one folder?


I have two folders in my setup, an express backend and a react frontend which I created with npx create-react-app. I want to push both to the same repository in the same branch but the problem is when I downloaded my react app and check my source control, it split up for some reason. I did git init in the root directory which contained both these folders but it still split them up in the source control:

enter image description here

I'm not sure how to push them to the same repository, some advice or things I should do at the start would be helpful. I'm able to download my backend and create a new frontend since I haven't really done much with my frontend so if a solution which requires me to do something from the get-go of installing react arises, I can do that.


Solution

  • It's likely that your frontend and backend folders each have their own .git folders within. Which would make each of them a git repository as that's where all source control data is kept.

    If you are fine with wiping out their history (not your changes/files), then delete the two .git folders and try again from the root directory containing both folders.