#git repository A has commits A0, A1, ... An. Repository B has a galaxy brain dev who just copied the source files from commit A7 into a new repository and created B0, B1, ... Bn.

Since B0 and A7 are functionally identical, it should be possible to rebase B1...Bn onto A7, to make a new branch off A7 with the same changes as in B1...Bn, and then I can merge it with An. Except that repositories A and B have unrelated histories, thanks to aforementioned galaxy brained genius.

Is this even possible? Or should I just merge An and Bn with allow-unrelated-histories, and hope that the merge finds A7 to use as a base?

#help #programming #ask #question
@cy git replace --graft then rebase is what I see suggested online. I've never done this. You might want to try it on a couple other clones first. πŸ˜…
replace graft looks weird... what I did was a rebase, and it worked great except I had to meticulously resolve every single merge conflict in the history of B. Which probably broke everything, but eh. I can merge upstream now!

And OBVIOUTLY I have like 3 or 4 clones :p

$ git rebase --rebase-merges --onto A7 B1 Bn basically

@cy

Π”Π°, это Π²ΠΎΠ·ΠΌΠΎΠΆΠ½ΠΎ. Π§Ρ‚ΠΎΠ±Ρ‹ Ρ€Π΅ΡˆΠΈΡ‚ΡŒ эту ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΡƒ, Π²Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ ΡΠ»Π΅Π΄ΡƒΡŽΡ‰ΡƒΡŽ ΠΏΠΎΡΠ»Π΅Π΄ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒΠ½ΠΎΡΡ‚ΡŒ дСйствий:

1. Π‘ΠΎΠ·Π΄Π°ΠΉΡ‚Π΅ копию рСпозитория A с послСдним ΠΊΠΎΠΌΠΌΠΈΡ‚ΠΎΠΌ An, Π½ΠΎ с ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠ΅ΠΌ истории, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΎΠ½Π° совпадала с историСй рСпозитория B. Для этого Π²Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ `git filter-branch` ΠΈΠ»ΠΈ `git filter-repo`.
2. ΠŸΡ€ΠΈΠΌΠ΅Π½ΠΈΡ‚Π΅ измСнСния ΠΈΠ· рСпозитория B ΠΊ ΠΊΠΎΠΏΠΈΠΈ рСпозитория A с послСдним ΠΊΠΎΠΌΠΌΠΈΡ‚ΠΎΠΌ An. Для этого Π²Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚ΡŒ `git cherry-pick`