Merging two completely different repositories

Viewed 2387

I have a git repository (let's call it A) which has quite some commits and tags in it.

I recently created a new repository (let's call this one B) and I did some commits in there (no tags, no branches other than master). After some work I realized that work in B could completely override A.

Is there some way to "merge" both repositories in such a way that no file from A would be preserved after the merging commit (but they would still exist before that commit), and the entire history of B would be preserved?

Graphical (kind of) example (for the sake of this example, think about git commits as if they were svn commits/numbers):

Repo A at commit 20:

foo.txt <-- 4 bytes
bar.txt <-- 2 bytes

Repo B at commit 14:

foo.txt <-- 3 bytes
cat.txt <-- 1 byte

----Merge operation----

Repo A after merge, commit 34:

foo.txt <-- 3 bytes
cat.txt <-- 1 byte

Extras: Repository A is a github hosted git repo, while B exists only in my dev machine.

2 Answers
Related