0

The project I'm working on at my job is composed of 2 main repositories frontend and www. Every time we code a new feature we often need to create a branch for each repo, push code on each repo, create commits on each repos, etc. We really hate this pattern.

Let's say we'd want a directory project with 2 subdirectories frontend and www and merge the two repos's .git folder at the root of the parent directory. Is it complicated?

Our goal is to end up with one single repo. This way we'd be able to type commands like git status inside the project directory and see changes for both frontend and www without having to cd into the other directory each time.

I know it's possible, but can't imagine a way to attempt this big change.

We don't want to lose history for both 2 repos. We have issues, PR and tags that we'd like to keep.

Hope you'll help me find an easy solution!

  • do you have identical files in both projects? – Serge Sep 28 '18 at 01:59
  • Possible duplicate of [How do you merge two Git repositories?](https://stackoverflow.com/questions/1425892/how-do-you-merge-two-git-repositories) – wsha Sep 28 '18 at 02:32

1 Answers1

0

These are not in any special order

Solution A

Copy frontend, without the .git folder into the www repo (and loose frontend's history)

Solution B

Create a new fresh repo from the two old ones (just copy the folders and loose the history)

Solution C

How do you merge two Git repositories?

Note: Below the accepted answer there is answer with many more upvotes.

Community
  • 1
  • 1
tymtam
  • 31,798
  • 8
  • 86
  • 126