We are trying to migrate away from TFS. Using the git-tfs tool, we were able to migrate parts of the existing repo, but it crashes at certain troublesome checkins. We have been able to make a patchwork set of Git repos that cover most of the original TFS commits.
Currently have:
Desired:
Is there any way for us to stitch these back together into a single Git repo? We don't care about retaining SHAs (they're all new anyway), but we can't break file history.
edit: recent versions of git has now extended the git replace
command to do it more easily with git replace --graft <commit> <parent>
(See https://git-scm.com/docs/git-replace#Documentation/git-replace.txt---graftltcommitgtltparentgt82308203 )
There is an easy way to do that using the 'graft' feature of git. it's a feature with the same goal than git replace
that @torek mentioned but that is easier to use in your case.
First, import all the histories in the same repository. In the most recent repository, do for the 2 others:
git remote add c:/path/toward/other/repository
git fetch
Then create the git graft file .git/info/grafts
following the help:
https://git.wiki.kernel.org/index.php/GraftPoint
(you should have 2 lines in your file)
If you use git log
or any Git GUI, you now should see the history like you want it.
If you are satisfied, then rewrite the history to make it definitive with:
git filter-branch
You could now push your history to a central repository or share it.
Ps: another doc on the subject but melting grafts and replace git features : https://legacy-developer.atlassian.com/blog/2015/08/grafting-earlier-history-with-git/