1

I have two folders, one is for the Frontend and one is for the Backend, both are being tracked and have separate repos.

I want to combine them into one "Project" folder and then track that and push to a new repo which obviously will just house the full App.

Should I remove the tracking from the respective frontend and backend folders before initializing a local repo on the "Project" folder?
Or does it not even make a difference in this case?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

1 Answers1

1

It depends if you need to keep the history of those two repositories.

What you cannot do is simply add a commit those folders in a new parent repo, as it would only records "gitlinks" for the nested Git repositories

Project
  .git
  FrontEnd
    .git
  Backend
    .git

If you simply remove the nested .git folders... you are just importing subprojects files, without history

Project
  .git
  FrontEnd
  Backend

If you want to combine both repos in a larger one, you can follow "Combining multiple git repositories", which uses git filter-branch, although this commands starts to be deprecated for git filter-repos.

If you just want to reference them within your Project repos, you can add both subrepos as submodules.
You also have the subtree approach. See "Differences between git submodule and subtree".

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you much! This response was more than expected and very helpful! – Anel Drocic Oct 15 '19 at 14:34
  • 1
    @AnelDrocic You are welcome. Don't forget to review your past question, and select an answer there as well, if said answer was satisfactory. – VonC Oct 15 '19 at 14:36