My Digital Garden

Merging Two Projects Into One Git Repository

Merging Two Projects Into One Git Repository (funkysi1701.com, 2025)

rw-book-cover

Metadata

  • Author: funkysi1701.com
  • Full Title: Merging Two Projects Into One Git Repository
  • Category: #articles
  • Document Tags: git howto
  • Summary: The article explains how to merge two Git repositories while preserving commit history. It outlines steps such as cloning the original repository, adding a new remote, and merging commits. The process allows for a clean integration of projects, keeping all historical changes intact.
  • URL: https://www.funkysi1701.com/posts/2025/merge-two-projects-into-one/

Highlights

  • Recently, I worked on merging two separate projects into one. (View Highlight)
  • Clone the original repository (View Highlight)
  • Add the new repository as a remote (View Highlight)
  • Fetch the commits from the new repository (View Highlight)
  • Merge the commits from the new repository (View Highlight)
  • git merge project2/develop --allow-unrelated-histories (View Highlight)
    • Note: —allow-unrelated-histories is essential
  • Fix merge conflicts (View Highlight)
  • Push the changes to the original repository (View Highlight)
  • Test your code to ensure everything builds and runs as expected now that it is all in one repository. Create a Pull Request and review all the changes to ensure nothing gets changed that shouldn’t be. (View Highlight)