I'll try to be as succinct as possible:
** background **
I started a project for a non-profit org with some friends a couple months ago; as we are not charging anything, a couple of friends abandoned ship (understandably enough as they are really busy at their actual jobs). However, those guys were in charge to develop front end of the project.
I took over of the front-end (initially thought with vuejs, I used vuejs + quasar framework).
In the initial repository (gitlab), front-end (vue) and back-end (django + postgres) were included in different directories under the same repo (I am a newbie so I dont know if this is good practice or not, with this I mean there is a repo in gitlab with a /backend directory and a /frontend firectory, each containing the respectively code).
I wasn't sure If they were coming back or not so I developed in my own device and pushed to my own github. In the end, they didn't come back and I finished the mock up's so now I want to push to gitlab in order to continue with the project.
** the goal **
I want replace the existing code under the repository's "/frontend" directory with my own code (as stated, there is also a "/backend" directory which contains the django code and off course, should'nt be removed).
** what I have researched **
As I have researched, I have found the following options
- mirror the new code into the old project. I found one article explaining how I can use the --mirror flag to copy my code to the project:
cd my/own/repo/path
git push --mirror gitlabs/old/repo
THE ISSUE: I think this will overwrite the backend development and only keep my FE code.
- add the new code as a submodule of the initial project
cd initial/project/
git submodule add frontendDirectory
git commit -m "Added the FE submodule to the project."
git push
THE ISSUE: Although I think this is the way to go, I am having the following doubts:
a) will it erase all previous code in the frontEndDirectory or should I manually erase it beforehand? (I mean, I could easily remove it using rm -r initial/project/frontendDir/ but I dont know if this is good practice or git has a built-in option).
b) the intial repo had both FE and BE together and now I partitioned them (FE specifically); although I'd think this is the best practice I don't feel competent enough to impose it (now BE will have to "git submodule update --init --recursive" if they want to pull the FE, as I understand).
c) I'd have to manually update the FE submodule every time and have to keep working on the github repository instead of merging everything to the gitlab repo.
- Manually removing old FE code and copying new code.
Nothing would seem simpler as erasing old code with "rm -r" and copying the new one with "cp -r", and the pushing to gitlab, yet I have the following questions:
a) how would I initialize my quasar/vue project in the old repo? will the copy be enough as I am getting everything from the already initialize quasar/vue project? or should I initialize a quasar/vue project in the destination (old repo's FE dir) folder first and then import (copy) everything?
b) I will lose all the commits (I feel confy with my current code but still I think it'd be nice to keep the old commits).
c) This feels like cheating and that there should be a built-in git option for easily, locally copying everything from one project to another
I think this issue might be rather outdated and/or trivial, still would appreciate any input or recommended lectures as the ones I found don't seem to fully answer my questions.
Thanks in advance and cheers.