2

I have an Android app (let's call it Foo) with quite a bit of history started with Eclipse, then migrated to Android Studio. It used to have the following legacy directory structure:

Foo
 MyAndroidLibrary
 Foo

MyAndroidLibray and Foo had their own repositories separately. To address a variety of legacy issues, I recreated Foo with Android Studio from scratch. It has the following directory structure now:

Foo
 MyAndroidLibrary
 App

Now, there is only one repository for Foo instead of of two. I essentially copied all the files from the old MyAndroidLibrary to the new MyAndroidLibrary, and from the old Foo directory to the new App directory.

Is it possible to merge the two old repositories under MyAndroidLibrary and Foo respectively into the new repository under Foo?

Hong
  • 17,643
  • 21
  • 81
  • 142

1 Answers1

1

Assuming you want to keep their commits: You should first try (in a separate local repository for testing) to bring both repositories history into one new repo.

See "How do you merge two Git repositories?", using git filter-branch --index-filter, to adjust one project path.
Then pull it into your other repo.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thank you. I assume that you meant that you need to merge the two old repositories - MyAndroidLibrary and Foo - first into a new repo (say MergedFoo), then pull MergedFoo into the new Foo. I will give it a shot tomorrow and report back. – Hong Dec 17 '18 at 06:32