I was hoping for some sort of command like git tfs repair
to correspond to the verify command. However, in lieu of finding something like that, I was able to solve this problem in two different ways. I had two repositories that were messed up, and one of them I had another copy of which was good (I had cloned it successfully for my own private use of Git before the department started to migrate from TFS to Git). The other I did not have a pre-existing copy, and every time I attempt to clone it I get the same problems.
The two solutions before worked to patch up the current state of the repo but of course did not tell the truth about the history. It would still be nice if there were any possible way to do something along the lines of git tfs repair
.
When you already have another repo without discrepancies
I added my good repo as a remote to the repo I was trying to patch up:
git remote add goodclone C:/path/to/good/clone
Then I fetched from that remote:
git fetch goodclone
Git issued a warning that none of the commits were the same (this is a function of them having been cloned from TFS through Git-TFS at separate times). I knew this was true so that's okay. It just meant the clone took a while longer.
I checked out a branch from master
to do the work on.
git checkout -b repair
I also checked out a branch from the good repo's remote, for good measure:
git checkout -b goodclone-master goodclone/master
I then merged:
git checkout repair
git merge --squash goodclone-master
I had to patch a couple things up, then I committed. I ran the TFS-Git sync process again, switched to master and pulled down the latest changes, rebased the repair branched on master, merged it into master, and pushed.
As far as I can tell, things are good now!
When you do not have another repo without discrepancies
I cloned the repository through TFS and then used Vim to create a script from the output of the verify command to copy the files over from the TFS repo. In the script I had to do mkdir -p
for the contains directories before copying the files. I then committed the files to patch things up. It seems to have worked but is something of a hack.