Skip to content

Can I merge multiple repositories into one single repository while keeping version history? #143759

Discussion options

You must be logged in to vote

If you have created multiple repositories for different modules of a course and now find it cluttered, you can merge them into a single repository while preserving all the information. Here’s how you can do it:

  1. Create a New Repository:
    First, create a new repository on GitHub or locally on your machine.

    git init all-coursera
    cd all-coursera
  2. Add the Other Repositories as Remotes:
    Add the repositories you want to merge as remotes in the new repository.

    git remote add coursera-mod2 <url-of-coursera-mod2 >
    git remote add repo2 <url-of-repo2>
  3. Fetch the Commits from the Other Repositories:
    Fetch the commits from the other repositories.

    git fetch coursera-mod2
    git fetch repo2
  4. Create New …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by thisisiris
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 Question
3 participants