2

I'm trying to migrate TFS to GIT with all branches with history using git-tfs tool. But I'm getting only few of the branches successfully and others with missing history (most recent once). And few of the branches not even migrated. I've used below command for migration:

git tfs clone <tfsurl> <trunk> --branches=All --debug

I've received below errors for branches and changesets in debug logs:

Looking for changeset 78197 in git repository: CacheIsFull, stopped looking.
error: an error occurs when initializing the branch. Branch is ignored and continuing...

I've also looked in the relevant post for similar issues but none of them provided the solution. For example: https://github.com/git-tfs/git-tfs/issues/461

I'm expecting to migrate all the branches and history from TFS to GIT repository.

1 Answers1

0

This is not an official tool which handle by 3rd-party team. And according to their description:

This project is no more actively maintained because we are no more users of TFS. Thus being very useful, git-tfs is not exempt of not supported use cases. If you encounter something missing or a problem, please contribute, we will be pleased to help you.

And remember:

The fastest way to get an issue fixed is to submit a PR that fixes it.

The slowest way to get it fixed is to hope someone else will fix it.

Before you attempt a migration with Git-TFS, you should be aware that there are fundamental differences between the way TFVC and Git store history:

  • Git stores history as a snapshot of the repository in time, while TFVC records the discrete operations that occurred on a file. Change
    types in TFVC like rename, undelete and rollback cannot be expressed
    in Git; instead of seeing that file A was renamed to file B, you may
    only see that file A was deleted and file B was added in the same
    commit.
  • Git does not have a direct analog of a TFVC label: labels can contain any number of files at any specific version and can reflect files at different versions. Although conceptually similar, Git tags point to a snapshot of the whole repository at a point in time. If you rely on TFVC labels to know what was delivered, Git tags may not be provide this information.
  • Merges in TFVC occur at the file level, not at the entire repository. You can merge only a subset of changed files from one branch to another, then merge the remaining changed files in a subsequent changeset. In Git, a merge affects the entire repository, and you cannot see both sets of individual changes as a merge.

Source Link

Because of these differences, we generally advise users to do a tip migration and keep their TFVC repository online but read-only to view history.

This is the approach that Microsoft took when it migrated Windows and other products from centralized version control to Git.

For tip migration, just use the official TFVC import tool.

If you insist on using git-tfs, I have also go through some similar issues, there are multiple root causes such as some branches been renamed(deleted and created a new one), infinite loop pull particular branch, dead branches, long clone and so on.

There seem to be several ways and workaround. You may have to dig into them and find the right approach based on your own situation.

Community
  • 1
  • 1
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • Thanks for details @patricklu-msft, also I found below command useful to retrieve some more branches which failed in clone command. **git tfs branch -init --all** – Dharmendra Kumar Aug 02 '19 at 03:50
  • @DharmendraKumar Thanks for your useful sharing, which will also helps others in the community. – PatrickLu-MSFT Aug 02 '19 at 05:06