0

There was once a giant repository. Months ago, it was split up by making a copy of it for each sub-repo and running this on each copy:

git filter-branch --subdirectory-filter dir-to-become-a-sub-repo/ -f

Now I want two of those sub-repos to be one, as though they were split off from the giant repository together in the first place (while preserving all the commits made to them since then).

I tried to follow the procedure here (I found many slight variations of it pasted around stackoverflow too): https://saintgimp.org/2013/01/22/merging-two-git-repositories-into-one-repository-without-losing-file-history/ But it merely clumped the two repositories together without fusing the old commits that had matching messages and timestamps.

For example: After following the merge procedure in the link, there are two "Initial commit" commits on separate lines of the timeline, and they both have the exact same message and timestamp. I want pairs of commits like these two to be squashed into one commit again.

davidtgq
  • 3,780
  • 10
  • 43
  • 80
  • Have you tried this approach? https://stackoverflow.com/questions/42292219/merge-two-git-repos-and-keep-the-history – Guy Hoozdis Feb 28 '19 at 09:35
  • There might a confusion in the terms here, since a merge does **not** ever fuse any commits together, it only creates new commits. "Two commits **merged** into one commit" is a non-conventional use of "merge" in the git lingo. Not to nit-pick, of course, I get this is a colloquial use of the term, but I thought it might be useful to make the distinction explicit. – Romain Valeri Feb 28 '19 at 09:35
  • I edited the question to not use "merge" that way, hopefully it's more clear – davidtgq Feb 28 '19 at 10:08

0 Answers0