I will separate the two following parts :
- bring the history of the old repo in your current repo
- stitch together your current history with the old history
- bring in the history
You can use git bundle but copying the repository (the crucial part is to copy the .git/ directory) is actually enough.
In both cases, once the bundle or the repository is copied next to your current repo, you can use the bundle/the copy as a remote :
# using git bundle :
# from the old repo :
git bundle create ../oldrepo.bundle --all
cp ../oldrepo.bundle /mnt/thumbdrive
# on the new repo :
cp /mnt/thumbdrive/oldrepo.bundle ~/
git remote add old ~/oldrepo.bundle
# copying the repo :
# from the old repo :
cp -r .git/ /mnt/thumbdrive/old.git
# on the new repo :
mkdir ~/oldrepo
cp -r /mnt/thumbdrive/old.git ~/oldrepo/.git
git remote add old ~/oldrepo
You now have a remote named old, which points at the old content,
run git fetch old and you will have a complete copy of the old history in your new repository :
$ git branch -r
old/master
old/feature/one
old/feature/two
...
- stitch the histories together
If your new history has an identified commit which matches the exact content of a known old commit :
$ git log --oneline --graph old/master
* eacf32 (old/master) <that commit when we migrated>
* dbde41 other commit
...
$ git log --oneline --graph master
* eaed50 (HEAD -> master) current head commit
...
* 57a7aa <that commit when we migrated>
you can simply use git rebase :
# rebase on top of old/master all changes that came after 57a7aa :
git rebase --onto old/master 57a7aa master
Check that the resulting history is what you expect ; if you had already shared your master branch, you will need to force push your updated master to update.