8000 How can you merge two repositories while keeping all commit and contribution history? · community · Discussion #75875 · GitHub
[go: up one dir, main page]

Skip to content

How can you merge two repositories while keeping all commit and contribution history? #75875

Discussion options

You must be logged in to vote

Hello, I am not very familiar with Git, but I did manage to merge two and more repositories into one. (after a few unsuccessful attempts seeking help on the internet, I did manage to get assistance from here).

Here's what I did:
I wanted to merge repo-a into repo-b.
I opened repo-a with GitHub Desktop (cloned),
opened it in VSCode, and accessed the terminal in VSCode (bash).

$ git remote rm origin
$ git remote add origin url_to_repo-b
$ git fetch
$ git checkout main  # Adjust the branch name as needed
$ git pull origin main --allow-unrelated-histories

Now, all the files showed up in the same folder as repo-b.

$ git push origin main

I checked in GitHub Desktop if any changes were left to…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@reuelrai
Comment options

@rnv812
Comment options

@andybeet
Comment options

Answer selected by dascrapy
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Repositories The core of version-controlled code storage General General topics and discussions that don't fit into other categories, but are related to GitHub
0