if RepoB was done from RepoA history (as a true fork: starting from RepoA, and changing everything in it), then importing RepoB history in RepoA coud be done (assuming the main history to merge is on the master
branch) using "ours
" git merge
merge strategy:
cd /path/toRepoA # local clone
git remote add repoB /url/to/repoB
git fetch repoB
git checkout -b masterRepoB repoB/master
git merge -s ours master
That merge will make git consider master
as merged to repoB/master
... while keeping only repoB/master
content (no files from repoA/master
is in the result of that merge).
See also "Why would one use “git merge -s ours
”?".
Then:
git checkout master
git merge masterRepoB
That will fast-forward HEAD from master
to masterRepoB
, making that master
branch identical to repoB/master
(masterRepoB
)
You can then push master
to /url/repoA: its content will be the one from repoB.