I have two Git repos, foo/master and bar/master:
In foo:
code_root
->dirA
->dirB
-> *some files*
In bar:
Check out the git book and git magic. Depending on the exact changes, perhaps a round of history rewriting (git filter-branch
and friends; or brute-force application of git rebase --interactive
, straightening out each commit) can restore sanity to the mangled clone, and then allow a clean merge.
Other alternative is to export each commit as a patch (essentially run git format-patch
), recover the commit data from there and reverse engineer the patches to apply. You could even use the oportunity to rewrite a cleaner/simpler history when doing this.
Clearly the viability depends on the extent of the divergence, and how many "wrongly applied" commits are at stake.