Git -tf checkin failed: commit [commitid] has several parents. Using the --deep Option to Create History in TFS

Neither --deep nor --shallow to work. I get an error when I try to make git-tf checkin --deep into a new folder (currently empty) in TFS. I have a git repository with a pretty big story. I would like to save / migrate to TFS as part of git-tf.

I understand that checkin --deep will create a similar set of changes in TFS for each commit. The problem is that any commit in the git repository that appears to be the result of a merge (and we have a lot of merges in this repo) seems to make the git-tf command very unhappy and reports the error that I mentioned in the header (except [commitid] is replaced with the actual commit identifier (for example, 9a26d8)).

I’m not sure that I don’t have enough boats here or what. Is there a reliable way to port a pre-existing git repository with multiple merges in history to TFS? I expected this to be a primitive function / fix. Hope I missed something. I am very strong with TFS, but not as flavored with git, so any help is appreciated.

+4
source share
1 answer

The problem is that the complex merge history in TFS is difficult. Simply put, git commits can have multiple parents, while a set of TFS changes can have only one.

Consider the state in which my git repository has HEAD with some commit, say 9c42ef... Now I make the changes and commit them, creating a new commit 1f23cd... Meanwhile, I also accept the changes from Bob, who was also commit based on 9c42ef... Its change is commit ID f41ac3... If I want to enable both changes, I will need to merge, and I will say that ultimately with the identifier commit ID 7acdfe... Your chart now looks like this:

  1f23cd / \ 9c42ef 7acdfe (HEAD) \ / f41ac3 

This cannot be easily represented in TFS, since there can only be one ancestor in a single set of changes (the set of changes immediately before it). Therefore, we need to linearize the story. This is why the --squash and --auto-squash exist on git-tf checkin (with deep control).

The --squash allows you to choose which path to follow when going through the story. For instance:

 git-tf checkin --deep --squash f41ac3 

Omitting f41ac3 , walking along the schedule, you will have three sets of changes, the contents of 9c42ef , 1f23cd and 7acdfe . But on a large chart, it's a lot of work to indicate every commit for squash. In this case, --auto-squash will use magic to determine which path to follow. (He prefers the path with the longest chain of commits, so you get the longest history, and if the two segments are the same length, they will use timestamps to determine which path to follow.)

 git-tf checkin --deep --auto-squash 

You can also repack, so the commits you checked were linear, and each of them had only one parent.

git-tf developers use each of these strategies depending on the complexity of the tree, masochistic feelings about a set of endless lines of SHA1 hashes, and the moon phase.

+16
source

All Articles