✅ How can I take 2 existing repos (client and backend) and combine them?
I've always made my frontend and backends separate repos, and would like to instead make set it up where the frontend and client are both in the same repo. But it doesnt seem as simple as just creating a parent folder with 2 subfolders one for frontend and one for backend and then or am I wrong? I assumed you'd have one .gitignore in the root instead of a .gitignore in each subfolder? Or because how .net has solutions is it more complex?
20 Replies
I would personally keep them separate, but if you want to merge them, just copy the project folders and add the projects to the combined solution (and merge any props files, configs, etc)
Is this an ASP.NET backend with a JS-based frontend?
yes
Specifically React frontend, and a .net web api backend
Oh what then absolutely keep them separate
You can certainly keep them in the same repo, but keep them separate from that point on
Is that common practice? I have them separate as of now, every repo ive ever made is separate
Just thought one repo is easier to share then 2 separate ones
something like this would be easy to use and pretty standard
its literally just sharing a repo, but two otherwise self-contained programs
thats what i was trying to do but having the .gitignore at the root confused me
we use this structure for our projects at work, and "combine" them in the build process (our FE is served by the backend as static files)
So, thats still one repo, and theres only .gitignore that handles "projects"
you could have multiple gitignores, if you want
you wouldnt ever really open the root folder in VS/VSCode
I use rider for the dotnet project, and vscode for the client
gotta go 🙂
yeah this is what i do, i just wanted to better organize my projects/git repos
Alright ill look into this more, i wanna take my 2 separate repos and make them one repo, so its easier to manage, but i dont wanna fuck anything up lol
Why don't you use git submodules ?
You can have multiple separate repositories and one parent which combines all of your projects together
my git knowledge extends to, i can push and pull and make repos if something goes wrong , go into panic mode, i can resolve merge conflicts when they happen tho
I plan to fully learn git one of the days,
or at least enough to be a semi-wizard lol
Alright ill look up git subtrees, I just made a new git repo and cloned both existing repos into it, but idk if thats gonna work
is this a viable way to do things without subtrees? https://github.com/CydoEntis/collabparty
yeah i dont wanna merge the repos together, i just want one repo where the separate frontend and backend exist.
HOpefully that makes sense
that's what i do currently
i might end up splitting it into separate repositories when i do automated deployments though
in fact i definitely will
Wait, should I maybe keep them a seperate repos then? I've never done docker before, but I got a raspberry pi, setup a linux server and i wanna dockerize my react frontend, .net backend and mssql db and put it all on my pi, and then setup automated deployments like when i update my git repo is automatically deploys the update, is that gonna be easier as separate repos?
It doesn't matter separate or not for deployment. If you wanna auto-deploy separately, then do multi-repos with multiple pipelines. Otherwise combine them into one
If you do one repo then there will be situations when you only commit to backend side, but since it is multi-project repo, you will re-deploy both: backend and frontend
So, if I were you, I will separate
so you can deploy a small part of your project, instead of everything
Ok then ill do that, thanks
When you have time can you tell me how you made this fancy explanation lol
you're the goat, thanks