gitgit-tfs

How to fake an initial merge of two unrelated branches


We are migrating from TFS VC using git-tfs. However, because of the nature of our branches (some branches were created by copying the folders, and not via branching), we could not migrate all the TFVC history. As such, our migrated branches do not share the same base.

To simplify the problem, this is our current situation:

I can run git merge qc --no-commit --no-ff --allow-unrelated-histories and solve the conflicts. That works fine. However, I need to create an initial merge first that only "connects" the branches, to then do a git merge qc and see the same 5 changed files, with the same diffs.

The reason for that is that we are still running git-tfs to synchronize. The developers need to get used to git (they have been working with TFVC since always, so now they are learning it). At some moment we will stop synchronizing, to start working with the git server. That's why we need to "fake" the history between the branches, or do a big merge that does not contain this 5 files, to then do another merge to show exactly the same differences as in TFVC.

Thanks in advance!


Solution

  • Checkout qc. Copy the five troublesome files elsewhere. Checkout the 5 files from release, thus overwriting them in qc so they are the same in both branches. Add and commit.

    Now checkout release and do the merge.

    Now checkout qc again and copy the five troublesome files back into place, overwriting them with the troublesome contents. Add and commit.

    Now checkout release again, and merge again, resolving as needed.