当 git tfs 无法创建合并提交时,它说warning: this changeset 7504 is a merge changeset. But it can't have been managed accordingly because one of the parent changeset 7494 is not present in the repository! If you want to do it, fetch the branch containing this changeset before retrying...
根据文档, Note: if you see a warning, you could correct that by reseting the tfs remote to a previous commit. Then fetch the merged branch and retry to fetch the branch.
谁能详细说明一下reseting the tfs remote to a previous commit
。不过,我现在已经获取了合并的分支,但我不明白如何将其重置为之前对失败分支的提交。我不确定,但我必须这样做吗git checkout <hash of the previous commit>
?
是的,现在 git-tfs 在遇到合并变更集时尝试创建合并提交(现在它具有令人满意的分支支持)。
此消息只是一条警告消息,当您看到它时,您有 2 个选择...
为此,您必须重置 tfs 远程(因为实际上已经创建了提交——以保持与 git-tfs 在以前版本中的工作方式以及那些无法使用分支的兼容性)。
要重置遥控器,您必须使用远程重置命令。
然后初始化合并到父分支中的分支分支--init.
还将本地分支重置为 tfs 远程(由于内部 git-tfs 优化)。
并再次获取父分支。现在合并的分支已经存在并且可以获取,git-tfs 将从合并的分支中找到父变更集,并且您的 git 存储库中将有一个漂亮的合并提交;)
所以,如果你早些时候这样做了
git tfs clone https://CompanyName.visualstudio.com/DefaultCollection "$/CompanyName/Main" KfGitMain --workspace="C:\TFS\Main"
cd GitMain
git tfs branch --init "$/CompanyName/Release/20140121.1" live20140121.1
git tfs branch --init "$/CompanyName/Release/20140121.1-hotfix" hotfix20140121.1
如果您由于代码相互合并而收到所有这三个警告,那么您将不得不
git checkout hotfix
git tfs reset-remote 5fb83335b8dfc6fbb96e0a54a48dc06c506e3277 ## previous commit of the first failed commit
git reset --hard tfs/hotfix
git tfs pull -i hotfix
git checkout live
git tfs reset-remote eba62a1446f3f81676d051336ca254fe54c37d74
git reset --hard tfs/live
git tfs pull -i live
git checkout master
git tfs reset-remote 72727737ec52f9b96d22d343770186a342c8b166
git reset --hard tfs/default
git tfs pull -i default
注意:如果您没有太多分支和/或奇怪的 tfs 历史记录,所有这些都可以使用来避免git clone
与选项--with-branches
这将初始化并获取所有负责合并变更集的分支
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)