0

I have been working on a project within a git repository (let's call it Repo A). However, as I found myself wasting far too much time fiddling around with my own build configuration, I decided to try to make use of one of the many boilerplate/starter-kit projects (let's call the one I chose Repo B).

Now, my issue is, how would I merge the two repositories in such a way that I retain all the history of Repo A without losing the ability to, later on, pull/merge updates from Repo B?

For reference, at the time of writing, the repositories are:
Repo A: https://github.com/Braden1996/tron.io/commit/33ccf5335b0b693abeaf612aa65a5658dcfe1459
Repo B: https://github.com/ctrlplusb/react-universally

Braden1996
  • 108
  • 1
  • 7

1 Answers1

0

Okay, so I managed to figure this out.
For future reference, here is how:

  1. Add the Repo B as a remote to Repo A:
    git remote add repo-b repo-b.git
  2. Pull the files from our new remote:
    git pull repo-b master --allow-unrelated-histories
  3. Resolve merge conflicts:
    git mergetool
  4. Reset the HEAD - to prevent obtaining the full history of Repo B:
    git reset HEAD
  5. Add all changes to be staged for the next commit:
    git add *
  6. Commit changes:
    git commit -m "Pull repo-b into our repo-a"
  7. Push branch:
    git push

To obtain future updates, start the process from step 2.

Braden1996
  • 108
  • 1
  • 7